Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of (?s) in regex

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

like image 843
Barry Chum Avatar asked Sep 06 '25 03:09

Barry Chum


1 Answers

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.)

like image 87
Chris Moutray Avatar answered Sep 07 '25 21:09

Chris Moutray