sathya_myl has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to replace a single character in a word with wild character and ended up with error
Here is my code
my $test = "Here is the there"; $test =~s/(ther*)/\<test\>$1\<\/test\>/ig; print "$test\n";
The output is "Here is <test>the</test> <test>the</test>re"
But the expected output is "Here is the <test>there</test>
My intention is this * need to represent a character after the string ther.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wild card in regular expression
by davido (Cardinal) on Nov 28, 2012 at 21:09 UTC | |
|
Re: Wild card in regular expression
by moritz (Cardinal) on Nov 28, 2012 at 21:09 UTC | |
|
Re: Wild card in regular expression
by toolic (Bishop) on Nov 28, 2012 at 21:14 UTC |