(?s)在正则表达式中的含义 [英] Meaning of (?s) in regex

查看:851
本文介绍了(?s)在正则表达式中的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很正常的表达舞台。最近我搜索了一个Powershell的正则表达式,允许我匹配一个html标签,我在这个网站找到了以下内容。

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

我一直在寻找所有正则表达式的引用和书籍(Perl和Powershell),意思是(?s)没有运气。它看起来像一个条件,但缺少当时的部分。



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



谢谢

解决方案

根据正则表达式参考站点


打开点匹配换行符常规
表达式的剩余部分。 (旧的正则表达式可能会为整个正则表达式打开它。)



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

解决方案

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

这篇关于(?s)在正则表达式中的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆