哦,这样也可以匹配空格啊,以后又可以方便了啊
- <SCRIPT> re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); document.write(newstr) </SCRIPT>
哦,这样也可以匹配空格啊,以后又可以方便了啊
- <SCRIPT> re = /(\w+)\s(\w+)/; str = "John Smith"; newstr = str.replace(re, "$2, $1"); document.write(newstr) </SCRIPT>