标签:ons 存储 abc get blog span div info replace
1.(pattern)
var _verification = /^<([^<>]*)>$/; var _str = "<ABC>"; var _getStr = _str.replace(_verification, "$1"); console.info(_getStr );//ABC
_verification.test(_str);//true
console.info(RegExp.$1);//ABC
$1为第一个括号里面的匹配, $2为第二个括号匹配,以此类推...
2.(?:pattern)
var _verification = /^<(?:[^<>]*)>$/; var _str = "<ABC>"; _verification.test(_str);//true console.info(RegExp.$1);//""
加上?:之后只做匹配不进行存储,例如不会存储成$1,$2
javascript (pattern) (?:pattern)
标签:ons 存储 abc get blog span div info replace
原文地址:http://www.cnblogs.com/mzbdadou/p/7240161.html