Matching single lines in multiline text blocks

zarqon

Well-known member
I have a situation where I'm parsing the session log and matching entire specific lines.

Presently my matcher looks like this:

WARNING: REGEX AHEAD. PLEASE USE APPROPRIATE SAFETY PRECAUTIONS WHEN HANDLING.

PHP:
create_matcher("\\bSpecific keywords (.+?)\\n",log);

NOW LEAVING REGEX CONTAINMENT AREA. THANK YOU FOR READING SAFELY.

It works well enough, but it's rather easy to break given the right (wrong) user output from a script. What I'd really like, instead of matching on the initial word boundary and the closing newline, is to be able to use SOL/EOL (^ and $). However, it appears that this only matches the beginning and end of the entire log, as is often the case in various languages unless the multiline flag is specified. But can ASH matchers do flags? I tried various things I could think of to try to put that crucial "m" on the end, but to no avail.

Is there a way to specify the multiline flag in a regex so that it matches lines of text inside the string as well? Or optionally, is there an amplified regex I could use? Guidance much appreciated!
 
Top