|Welcome to the Monastery|
Regular Expression problem with $variable =~ m/C++/by Manlio (Novice)
|on Jun 11, 2007 at 14:35 UTC||Need Help??|
Manlio has asked for the wisdom of the Perl Monks concerning the following question:
Hi to everybody,
Often I need to read a CSV file with delimited by commas. In order to find more quickly the value of a variable, inside the lines I use the matching regular expression $variable =~ m/.../.
Today I read a file with the 'C++' string inside (Only later I have understood that responsibility was of the 'C++' string).
The script has stopped with the following error message:
Nested quantifiers in regex; marked by <-- HERE in m/C++ <-- HERE / at....
So I have created a dedicated test script in order to verify the problem:
In this code if the $VarString (string looked for) is 'PHP' (for example) it's all okay, but if you set 'C++' the problem arrives. Because the characters '++' they are considered inside of the match pattern.
Thanks for all the suggestions! M.