http://www.perlmonks.org?node_id=873131


in reply to Perl Regex

Regex given by Ikegami should do the trick, but in the example log you have mentioned some_fields before and after the required message. In that case you should remove the caret (^) to allow it matching anywhere in the string. E.g. /\bmsg="[^"]*"/

The example you posted has syntax errors. You have left the concatenation operator (.) while printing. I hope you are not redirecting your error output to /dev/null while running the script.