求正则,匹配href属性值(下面四类地址),确保准确,高分!!
<a id= 'my ' href= "index.html " title= "click "> Click </a>
<a id= 'my ' href= 'index.html ' title= "click "> Click </a>
<a id= 'my ' href=index.html title= "click "> Click </a>
带空格的地址
<a id= 'my ' href= "index 2.html " title= "click "> Click </a>
------解决方案--------------------于娜小姐好高的分
------解决方案--------------------样本
<a id= 'my ' href= "index.html " title= "click "> Click </a>
<a id= 'my ' href= 'index.html ' title= "click "> Click </a>
<a id= 'my ' href=index.html title= "click "> Click </a>
<a id= 'my ' href= "index 2.html " title= "click "> Click </a>
正则
href=(([ "| ']{1})[\w\. ]+(\2)|([\w\.]+))
结果
href= "index.html " is match
Group[0]=href= "index.html "
Group[1]= "index.html "
Group[2]= "
Group[3]= "
Group[4]=
href= 'index.html ' is match
Group[0]=href= 'index.html '
Group[1]= 'index.html '
Group[2]= '
Group[3]= '
Group[4]=
href=index.html is match
Group[0]=href=index.html
Group[1]=index.html
Group[2]=
Group[3]=
Group[4]=index.html
href= "index 2.html " is match
Group[0]=href= "index 2.html "
Group[1]= "index 2.html "
Group[2]= "
Group[3]= "
Group[4]=