-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
  • 19,159
  • 17
  • 71
  • 105
Timo Huovinen
  • 49,835
  • 33
  • 140
  • 131

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
  • 36,940
  • 12
  • 73
  • 83
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
  • 68,613
  • 12
  • 97
  • 138