in reply to Regex in string to be used for matching.
or just$string = 'My Test Data'; $regex = '(?i)\btest\b'; print $string =~ m/$regex/ ? "Match\n" : "No match\n";
$string = 'My Test Data'; $regex = '(?i)\btest\b'; print $string =~ $regex ? "Match\n" : "No match\n";
m// is implied if the RHS of =~ is not one of the ops that are affected by =~.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex in string to be used for matching.
by Anonymous Monk on Nov 09, 2009 at 22:02 UTC | |
by ikegami (Patriarch) on Nov 09, 2009 at 22:25 UTC |