文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>正则表达式举例

正则表达式举例

时间:2010-02-28  来源:hs272307562

{^[yY]}
 Begins with y or Y, as in a Yes answer.
 
{^(yes|YES|Yes)$}
 Exactly "yes", "Yes", or "YES".
 
{^[^ \t:\]+:}
 Begins with colon-delimited field that has no spaces or tabs.
 
{^\S+?:}
 Same as above, using \S for "not space".
 
"^\[ \t]*$"
 A string of all spaces or tabs.
 
{(?n)^\s*$}
 A blank line using newline sensitive mode.
 
"(\n|^)\[^\n\]*(\n|$)"
 A blank line, the hard way.
 
{^[A-Za-z]+$}
 Only letters.
 
{^[[:alpha:]]+$}
 Only letters, the Unicode way.
 
{[A-Za-z0-9_]+}
 Letters, digits, and the underscore.
 
{\w+}
 Letters, digits, and the underscore using \w.
 
{[][${}\\]}
 The set of Tcl special characters: ] [ $ { } \
 
"\[^\n\]*\n"
 Everything up to a newline.
 
{.*?\n}
 Everything up to a newline using nongreedy *?
 
{\.}
 A period.
 
{[][$^?+*()|\\]}
 The set of regular expression special characters:

] [ $ ^ ? + * ( ) | \
 
<H1>(.*?)</H1>
 An H1 HTML tag. The subpattern matches the string between the tags.
 
<!--.*?-->
 HTML comments.
 
{[0-9a-hA-H][0-9a-hA-H]}
 2 hex digits.
 
{[[:xdigit:]]{2}}
 2 hex digits, using advanced regular expressions.
 
{\d{1,3}}
 1 to 3 digits, using advanced regular expressions.
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载