Home > Backend Development > PHP Tutorial > 求正则婚配tab, t貌似也会匹配空格呢

求正则婚配tab, t貌似也会匹配空格呢

WBOY
Release: 2016-06-13 11:17:33
Original
898 people have browsed it

求正则匹配tab, \t貌似也会匹配空格呢
求正则匹配tab, \t貌似也会匹配空格呢


------解决方案--------------------
这么可能呢?分析如下
$s = ' 	'; //一个空格加一个制表符<br />echo current(unpack('H*', $s)); //2009 20是空格的十六进制内码,09是Tab键的十六进制内码<br /><br />preg_match("/\t+/", $s, $r);<br />echo current(unpack('H*', $r[0])); //得到 09<br /><br />preg_match("/ +/", $s, $r);<br />echo current(unpack('H*', $r[0])); //得到 20<br /><br />preg_match("/\s+/", $s, $r);<br />echo current(unpack('H*', $r[0])); //得到 2009<br />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template