Meaning of (?s) in regex

Barry Chum picture Barry Chum · Jun 7, 2012 · Viewed 15k times · Source

I am very new to the regular expression arena. Recently I searched for a regular expression for Powershell that allows me to match a html tag and I found the following in this site.

$content -match '(?s)<table[^>]+width\s*=\s*"300px"\s*.*?>(.*?)</table>'

I have been looking for all regular expressions references and books (Perl and Powershell) for the meaning of (?s) with no luck. It looks like a condition but missing the then part.

Can someone point me to the right direction for the meaning of this?

Thanks

Answer

Chris Moutray picture Chris Moutray · Jun 7, 2012

According to Regular Expressions reference site.

Turn on "dot matches newline" for the remainder of the regular expression. (Older regex flavors may turn it on for the entire regex.)