日期:2014-05-16  浏览次数:20367 次

正则表达式求 求详解求详解]
求详细解释区别,最好有例子

1,/<a[^>]*>/

2,/xxx[^<]*/

3,/xxx[^<]/

2与3相差一个*号,差别在哪
比如要把字符串里ASD替换为带链接的字符
用2与3分别替换,结果如下

原字符串
str="yyasdyyyyasdyyyy"

2表达式
str="yy<a href='1.html'><a href='1.html'>asd</a></a>yyyyasdyyyy"


3表达式

str="yy<a href='1.html'>asd</a>yyyy<a href='1.html'>asd</a>yyyy"

------解决方案--------------------
*表示任意多个
2是只xxx后边有任意多个非<的字符 包括0个
3是指xxx后边必须有一个非<的字符
------解决方案--------------------
你把代码发下吧  看不明白你的意思