-4

I'm using a regex to match strings in a source file. I have a regex:

(["'])(?:(?=(\\?))\2.)*?\1

It matches the opening and closing quotes only if they are on the same line. For example,

"hello world!" 

matches, but

"hello
world!"

does not.

Is it possible to modify this so that both cases are matched?

sawa
  • 165,429
  • 45
  • 277
  • 381
user2320239
  • 1,021
  • 2
  • 18
  • 43

1 Answers1

0

You are looking for the flag m (/regexp/m)

It's getting a little old, but http://rubular.com/ has a ruby regexp testing interface and the basic classes and modifiers remainder.