Home >Backend Development >PHP Tutorial >Implement 17 kinds of regular expressions in php, 17 kinds of regular expressions in php_PHP tutorial

Implement 17 kinds of regular expressions in php, 17 kinds of regular expressions in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:14:371012browse

17 kinds of regular expressions are implemented in php, 17 kinds of regular expressions are implemented in php

17 kinds of regular expressions are implemented in php

This tutorial comes from: php tutorial website: http://php.662p.com

"^\d+[        DISCUZ_CODE_1        ]quot;  //非负整数(正整数 + 0)
"^[0-9]*[1-9][0-9]*[        DISCUZ_CODE_1        ]quot;  //正整数
"^((-\d+)|(0+))[        DISCUZ_CODE_1        ]quot;  //非正整数(负整数 + 0)
"^-[0-9]*[1-9][0-9]*[        DISCUZ_CODE_1        ]quot;  //负整数
"^-?\d+[        DISCUZ_CODE_1        ]quot;    //整数
"^\d+(\.\d+)?[        DISCUZ_CODE_1        ]quot;  //非负浮点数(正浮点数 + 0)
"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))[        DISCUZ_CODE_1        ]quot;  //正浮点数
"^((-\d+(\.\d+)?)|(0+(\.0+)?))[        DISCUZ_CODE_1        ]quot;  //非正浮点数(负浮点数 + 0)
"^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))[        DISCUZ_CODE_1        ]quot;  //负浮点数
"^(-?\d+)(\.\d+)?[        DISCUZ_CODE_1        ]quot;  //浮点数
"^[A-Za-z]+[        DISCUZ_CODE_1        ]quot;  //由26个英文字母组成的字符串
"^[A-Z]+[        DISCUZ_CODE_1        ]quot;  //由26个英文字母的大写组成的字符串
"^[a-z]+[        DISCUZ_CODE_1        ]quot;  //由26个英文字母的小写组成的字符串
"^[A-Za-z0-9]+[        DISCUZ_CODE_1        ]quot;  //由数字和26个英文字母组成的字符串
"^\w+[        DISCUZ_CODE_1        ]quot;  //由数字、26个英文字母或者下划线组成的字符串
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+[        DISCUZ_CODE_1        ]quot;    //email地址
"^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?[        DISCUZ_CODE_1        ]quot;    //url

Detailed description: http://php.662p.com/thread-532-1-1.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/909084.htmlTechArticle17 kinds of regular expressions implemented in php, php17 kinds of regular expressions 17 kinds of regular expressions implemented in php this tutorial From: php tutorial website: http://php.662p.com "^d+[ DISCUZ_CODE_1 ]quot; //Non-negative integer...
Statement:
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