[\ S \ s] *在PHP的正则表达式中是什么意思? [英] What does [\S\s]* mean in regex in PHP?

查看:160
本文介绍了[\ S \ s] *在PHP的正则表达式中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP的正则表达式中的[\s\S]*是什么意思? [\s\S]*实际上是否匹配每个与.*相同的字符串?

What is meant by [\s\S]* in regex in PHP? Does [\s\S]* actually match every string the same as .*?

推荐答案

默认情况下,.与换行符不符-[\s\S]是解决该问题的工具.
这在JavaScript中很常见,但是在PHP中,您可以使用/s标志使点与所有字符匹配.

By default . doesn't match new lines - [\s\S] is a hack around that problem.
This is common in JavaScript, but in PHP you can use the /s flag to to make the dot match all characters.

这篇关于[\ S \ s] *在PHP的正则表达式中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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