I'm trying to manipulate multiline CoffeeScript comments in a file using perl. This is my regex:
^\t*###[\S\s]*?^\t*###
When I run this in a script where data is the file data, it does what I expect and replaces all multiline comments with "foo":
$data =~ s{^\t*###[\S\s]*?^\t*###}{"foo"}gme;
However, when I run this on the command line the file is unchanged:
perl -pi -e 's{^\t*###[\S\s]*?^\t*###}{"foo"}gme' file.coffee
I've used similar commands with different regular expressions and without the 'm' option and they all work. Is it the m option that's causing the issue? I'm sure its something simple.
\tas a literal tab char instead of the actual regex tab? What happens if you try escaping the backslashes?\\t?perl -pi -e 's{^\\t*###[\S\s]*?^\\t*###}{"foo"}gme' file.coffeeand still no joy.