Reputation: 18529
I have a multi-line string
Some test
String
Here
I am using this regex pattern to find it (Some\s.*)(.|\n)*
& replace it with \1\2
Instead of getting the same text back, I get
Some test e
Why isn't the second backreference working? Is there a better way to specify multiline in regex rather than (.|\n)*
PS : Using Sublime Text 2 on Windows
Update : I see my mistake after reading Jerry's answer.
Upvotes: 0
Views: 3625
Reputation: 71538
(.|\n)*
In this captured group, you'll get only the last match. You could try using this instead:
((?:.|\n)*)
Or if you want to match everything you could possibly use something like:
([\s\S]*)
Upvotes: 1