返回到:JavaScript对象:JavaScript RegExp 对象
n$ 量词匹配任何结尾为 n 的字符串。
new RegExp("n$")
或者
/n$/
对字符串结尾的 “is” 进行全局搜索:
var str="Is this his";
var patt1=/is$/g;
DEMO:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Web176教程(Web176.com)</title> </head> <body> <script> var str="Is this his"; var patt1=/is$/g; document.write(str.match(patt1)); </script> </body> </html>