日期:2014-05-17  浏览次数:20864 次

求一个正则表达式

sdfasfdas <br> <A   href= "http://bnr.jobdb.com/HK/Bnr.asp?URL=http%3A%2F%2Fwww%2Ejobsdb%2Ecom%2FHK%2
FEN%2FV6HTML%2FJobSeeker%2Fcreateresume%2Fcreateresume%2Ehtm&amp;IMG=%2FHK%2Fimages%2Fjdb%5Fpcb%5
Fdefault%2Ejpg "   target=_blank>
<IMG   src= "http://bnr.jobdb.com/HK/images/jdb_pcb_default.jpg "   border=0> </A> <br>

我现在想在Javascript里面写个function去替换掉上面字符串中的 <A   href...> <IMG...> </A>   ,请问该如何去写一个正则表达式去匹配?


------解决方案--------------------
JS:
var pat = / <A[^> ]+?href[^> ]+> \s* <IMG[^> ]+> \s* <\/A> /ig;
string.replace(pat, " ");


VBS:
Dim reg
Set reg = new RegExp

reg.Pattern = " <A[^> ]+?href[^> ]+> \s* <IMG[^> ]+> \s* <\/A> "
reg.IgnoreCase = True
reg.Global = True
reg.Replace(string, " ");