返回到:JavaScript对象:JavaScript RegExp 对象
定义和用法
source 属性用于返回模式匹配所用的文本。
语法
RegExpObject.sourceRegExpObject.source
实例
返回与正则模式匹配的文本:
<!DOCTYPE html>
<html>
<body>
<script>
var str="Visit web176";
var patt1=/web/g;
document.write("The text of the RegExp is: "+patt1.source);
</script>
</body>
</html>作者:terry,如若转载,请注明出处:https://www.web176.com/javascriptbook/jsarrtips/2955.html
支付宝
微信