Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php regepx-字符串中的奇数空格_Php_Regex - Fatal编程技术网

Php regepx-字符串中的奇数空格

Php regepx-字符串中的奇数空格,php,regex,Php,Regex,我正在对一些字符串执行一些regexp,并且在我的模式中匹配空格\s 但在一些弦中,我体验到一些奇怪的空间。。转换为十六进制时a0 如何将所有奇怪的空间转换为普通空间,以便使用regexp和和\s检测到它 当字符串显示为UTF8时,所有a0字符都表示为� 十六进制输入 作为字符串输入 a0表示-非中断空格 您可以将其与: [\s\xA0] 无需向[\s]字符类添加不间断空格,\s可以匹配任何Unicode空白,如果使用/u修饰符: '/\s/u' 见 发件人: 默认的“空格”字符是HT(9)

我正在对一些字符串执行一些regexp,并且在我的模式中匹配空格
\s

但在一些弦中,我体验到一些奇怪的空间。。转换为十六进制时
a0

如何将所有奇怪的空间转换为普通空间,以便使用regexp和
\s
检测到它

当字符串显示为UTF8时,所有
a0
字符都表示为

十六进制输入 作为字符串输入
a0
表示
-非中断空格

您可以将其与:

[\s\xA0]

无需向
[\s]
字符类添加不间断空格,
\s
可以匹配任何Unicode空白,如果使用
/u
修饰符:

'/\s/u'

发件人:

默认的“空格”字符是HT(9)、LF(10)、VT(11)、FF(12)、CR(13)和空格(32)。。。 如果使用Unicode属性支持编译PCRE,并且设置了
PCRE\u UCP
选项,则会更改行为,以便使用Unicode属性来确定字符类型:
\s
匹配
\p{Z}
\h
\v


PCRE\u UCP
动词和Unicode语义是通过
/u
修饰符启用的。

如果它来自HTML,
A0
。。。你不是在分析所见即所得编辑器中的数据吧?这是否意味着你在寻找一个正则表达式来匹配所有的空白?像
'/\s/u'
[\s\xA0]
'/\s/u'