Home > php教程 > php手册 > PHP中的POSIX字符正则类

PHP中的POSIX字符正则类

WBOY
Release: 2016-06-06 20:07:20
Original
1057 people have browsed it

[:alnum:]:文字数字字符 [:alpha:]:文字字符 [:digit:]:数字字符 [:graph:]:非空字符(非空格、控制字符) [:lower:]:小写字符 [:cntrl:]:控制字符 [:print:]:非空字符(包括空格) [:punct:]:标点符号 [:space:]:所有空白字符(新行,空格,制表符

[:alnum:]:文字数字字符

[:alpha:]:文字字符

[:digit:]:数字字符

[:graph:]:非空字符(非空格、控制字符)

[:lower:]:小写字符

[:cntrl:]:控制字符

[:print:]:非空字符(包括空格)

[:punct:]:标点符号

[:space:]:所有空白字符(新行,空格,制表符)

[:upper:]:大写字符

[:xdigit:]:十六进制数字(0-9,a-f,A-F)

在使用的时候,记得外面还要套上一对子中括号[]

例如

preg_replace('/[[:punct:]]/i','',$message);

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template