regex - 正则表达式中 (?s) 的含义

标签 regex powershell expression

我对正则表达式领域很陌生。最近我搜索了一个 Powershell 的正则表达式,它允许我匹配一个 html 标签,我在这个站点中找到了以下内容。

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

我一直在寻找所有关于 (?s) 含义的正则表达式引用资料和书籍(Perl 和 Powershell),但没有运气。它看起来像一个条件,但缺少 then 部分。

有人能指出我正确的方向吗?

谢谢

最佳答案

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

关于regex - 正则表达式中 (?s) 的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10927930/

相关文章:

parsing - Powershell删除第一个特殊字符实例后的文本

c# - 如何在运行时为 LINQ 和 Entity Framework 生成链式方法表达式?

php - 使用 PHP 删除空格

c# - 无法确定条件表达式的类型,因为 System.DateTime 和 null 之间没有隐式转换

支持Unicode的Java正则表达式?

javascript - 正则表达式文本替换使用 |和 () 捕获问题

Javascript 正则表达式将单斜杠替换为双斜杠?

javascript - 正则表达式以@符号开头

powershell - 检查 Powershell 中的范围

regex - 需要使用PowerShell从长配置文件中搜索一行