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

关于javascript截取字符串的问题
我从数据库中取出一长串字符,要从这个字符串中把中文名字拿出来,请问有哪位大神知道啊?

如:<a href="javascript:onUrl('/humres/base/humresview.jsp?id=HRMRESOURCEECOLOGYAAAA0000001087','刘亚军','tabHRMRESOURCEECOLOGYAAAA0000001087')" >刘亚军</a>
我要从这串中取出“刘亚军”该怎么取啊,还有就是姓名不一定全是三个字的

------解决方案--------------------
JScript code
var str = "<a href=\"javascript:onUrl('/humres/base/humresview.jsp?id=HRMRESOURCEECOLOGYAAAA0000001087','刘亚军','tabHRMRESOURCEECOLOGYAAAA0000001087')\">刘亚军</a><a href=\"javascript:onUrl('/humres/base/humresview.jsp?id=HRMRESOURCEECOLOGYAAAA0000001087','刘亚军','tabHRMRESOURCEECOLOGYAAAA0000001087')\">李四</a>";
str = str.replace(/<a\s[^>]*>(\S+)+<\/a>/g,"$1,");
alert(str);