Regex – Sublime Text regex not detecting multiline tags

regexsublimetexttags

I have this regex here;

\[sometag\](.*)\[/sometag\]

Which is supposed to catch text surrounded by the [sometag] tag. It works for single line information contained in these tags, like on the string [sometag]this is a bit of text[/sometag]. But it doesn't work on text that spans multiple lines, like this;

[sometag] here is more text

it spans more than one line [/sometag]

For some reason, Sublime text's regex finder won't recognize the tags across multiple lines. I want to know if this a problem with Sublime Text, a toggleable option, or just my personal incompetence with regexes.

Best Answer

At the start, use a dotall modifier (?s) to make dot to match also newline characters.

(?s)\[sometag\](.*?)\[\/sometag\]

DEMO