[EMAIL PROTECTED] wrote:
Hi,
I am a beginner in perl and am having a dickens of a time trying to identify
this pattern in messages. [URL
Here is what I have:
if ($FORM{'message} =~ /\[URL/ig) {
#do something;
}
Where $FORM('message') is a messaage that includes many lines and
[url=http://www.mywebspace.com[/url]. But this doesn't result in true even though I
know the message contains the string [url. Can anyone tell me what could be the
problem? Or perhaps a better way to identify a messages with the [url
anywhere in it. Thanks for any help.
works for me!
I assume missing ' is just a typo else you would get compile error
[EMAIL PROTECTED] re]$ cat url.pl
#! /usr/bin/perl
use strict;
use warnings;
my %FORM;
$FORM{'message'} = "
Where \$FORM('message') is a messaage that includes many lines and
[url=http://www.mywebspace.com[/url]. But this doesn't result in true
even though I
know the message contains the string [url. Can anyone tell me what
could be the
problem? Or perhaps a better way to identify a messages with the [url
anywhere in it. Thanks for any help.";
$FORM{'message'} =~ /\[URL/ig ? print "Found in message\n" : print "Not
found in message\n";
$FORM{'nourl'} = "this does not have bracket + url";
$FORM{'nourl'} =~ /\[URL/ig ? print "Found in nourl\n" : print "Not
found in nourl\n";
[EMAIL PROTECTED] re]$ ./url.pl
Found in message
Not found in nourl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>