<script >
$(function(){
var s="sss/jljlj";
var reg = /^(\w+)\/(\w+)$/;
if (reg.exec(s)) {
alert(RegExp.$1 + " " + RegExp.$2)
}else{
alert("aa");
}
if(reg.test(s)){
alert(reg.test(s));
}
/*if(s.indexOf("/")<0){
alert("不匹配");
}else{
alert("匹配"+s.indexOf("/"));
}*/
});
</script>
$(function(){
var s="sss/jljlj";
var reg = /^(\w+)\/(\w+)$/;
if (reg.exec(s)) {
alert(RegExp.$1 + " " + RegExp.$2)
}else{
alert("aa");
}
if(reg.test(s)){
alert(reg.test(s));
}
/*if(s.indexOf("/")<0){
alert("不匹配");
}else{
alert("匹配"+s.indexOf("/"));
}*/
});
</script>