1

Even if I use the m flag, javascript regex seems to isolate regex matching by lines.

Example:

"if\nend".match(/if(.*?)end/m)
=> null

I want this to match. How do I get around this?

0

1 Answer 1

2

You actually want s (a.k.a. "dotall"), not m, but javascript doesn't support that. A workaround:

"if\nend".match(/if([\s\S]*?)end/)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.