您好,欢迎访问一九零五行业门户网

正则表达式格式_PHP教程

正则表达式在php中被用来处理复杂的文字串。支持正则表达式的函数有:
ereg()
ereg replace()
eregi replace()
split()
这些函数都将正则表达式作为他们的第一个参数。php使用posix扩展规则表达式(使用posix 1003.2)。要找到所有的关于posix扩展规则表达式的描述,请查看包括在php发行版本之内的regex man页面。
example 2-4. regular expression examples
  ereg(abc,$string);
/* returns true if abc
is found anywhere in $string. */
ereg(^abc,$string);
/* returns true if abc
is found at the beginning of $string. */
ereg(abc$,$string);
/* returns true if abc
is found at the end of $string. */
eregi((ozilla.[23]|msie.3),$http_user_agent);
/* returns true if client browser
is netscape 2, 3 or msie 3. */
ereg(([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+ ),
$string,$regs);
/* places three space separated words
into $regs[1], $regs[2] and $regs[3]. */
ereg_replace(^,
,$string);
/* put a
tag at the beginning of $string. */
ereg_replace($,
,$string);
/* put a
tag at the end of $string. */
ereg_replace(,,$string);
/* get rid of any carriage return
characters in $string. */
http://www.bkjia.com/phpjc/531925.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/531925.htmltecharticle正则表达式在php中被用来处理复杂的文字串。支持正则表达式的函数有: ereg() ereg replace() eregi replace() split() 这些函数都将正则表达式作为...
其它类似信息

推荐信息