1024programmer News Regular expression functions in php There are two sets of regular expression function libraries in php. One is, PHP regular expression function library (two sets)…

Regular expression functions in php There are two sets of regular expression function libraries in php. One is, PHP regular expression function library (two sets)…

$string = “April 15, 2003”;

$pattern = “/(\w+) (\d+), (\d+), (\d+ 43;)/i”;

$replacement = “\${1}1,\$3”;

print preg_replace($pattern, $replacement, $string );

preg_match_all() for global regular expression matching

Grammar format :

preg_match_all (“|]+>(. *)[^>]+>|U”,

example:

this is a test”,

$out, PREG_PATTERN_ORDER) ;

print $out[0][0].”, “.$out[0][1].”

“;

print $ out[1][0].”, “.$out[1][1].”

“;

Output result :example: ,

this is a test example: , this is a test

Original :http://www.jb51.net/article/20400.htm

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索