rockstar99 has asked for the wisdom of the Perl Monks concerning the following question:
$mytarget = "I am a perl program"; $mystring = "Perl"; if ($mytarget =~ m/$mystring/i) { print "It matches\n"; } else { print "It doesn't match\n"; }
This prints "It matches" though the case does not match as I am using regex m//i . Now how can I actually fetch the actual string "perl" from $mytarget and print on the screen,
"The actual string in the target is : perl". Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex: Extracting the case insensitive string and printing on the output
by Ratazong (Monsignor) on Nov 28, 2011 at 10:10 UTC | |
by rockstar99 (Novice) on Nov 28, 2011 at 10:13 UTC | |
|
Re: Regex: Extracting the case insensitive string and printing on the output
by trizen (Hermit) on Nov 29, 2011 at 00:54 UTC | |
by AnomalousMonk (Archbishop) on Nov 29, 2011 at 08:16 UTC | |
|
Re: Regex: Extracting the case insensitive string and printing on the output
by ansh batra (Friar) on Nov 28, 2011 at 10:08 UTC |