将 while(arr=rcss.exec(“字符串”))
改为 var arr = rcss.LastIndexOf(".")alert("arr[1]")
<script type="text/javascript">function aa(id,text)
{
var s=document.getElementById(id).value
var patrn=/^[C|D|E|F]:\\.+\\.+$/
if (!patrn.exec(s)){
alert(text+"格式不正确!")
// $(id).focus()
return false
}
return true
}
</script>
<input type="text" value="" id="name"><input type="button" onclick="aa('name','aa')" value="提交"/>
相对路径是不以"://"或者“/“开头的,只要匹配到下面的就是绝对路径,否则是相对路径:<img\s+[^>]*?src="((\w+?://|/)[^"]*?)"[^>]*?>