[Boston.pm] Is there a modifier on m or s that says the argument is not a regex
Steve Tolkin via Boston-pm <[email protected]> Sun, 13 Jan 2019 21:27:48 -0500
| Newsgroups | gmane.comp.lang.perl.perl-mongers.boston |
|---|---|
| Message-ID | <[email protected]> |
Is there a modifier for m that says the argument is not a regular expression? Similarly for the or the first argument to s? I looked and did not find it. This seems like it would be useful. I want to extract certain lines from a log file. My perl program is basically lots of lines like: print if m/some string/; If the string contains a left or right parenthesis I must escape it or else get an error message that says the argument is "not a regular expression". So I have to escape each parenthesis with a backslash, which is tedious and error prone. I presume I would also need to escape at least the open square bracket, but have not had those in the file. Also, the string often contains lots of dots, e.g., is com.example.foo/bar/program.c at line(123) and this requested modifier would have a small performance benefit. -- Steve Tolkin