-4

What does this mean in regex?

(?s:.+?)

specifically

(?s

I've seen things like non capture groups (?:regex), lookaheads but this is the first time I see something like this, I got it from the MarkDownExtra parser definition lists part.

I was unable to find it on http://www.regular-expressions.info/ and Google because you can't physically google question marks, so I am asking here.

Also isn't .+? the same as .*?

aliteralmind
  • 18,274
  • 16
  • 66
  • 102
Timo Huovinen
  • 46,329
  • 33
  • 128
  • 127

2 Answers2

2

Using this link You can get explanation of your regex.

NODE                     EXPLANATION
--------------------------------------------------------------------------------
  (?s)                     set flags for this block (with . matching
                           \n) (case-sensitive) (with ^ and $
                           matching normally) (matching whitespace
                           and # normally)
Sabuj Hassan
  • 35,286
  • 11
  • 68
  • 78
2

It is an inline modifier:

(?s)

That was extended so that only the part within the group is affected. This means that the . within the group will be on 'dotall' mode (or match newlines too).

Jerry
  • 67,172
  • 12
  • 92
  • 128