RegExp . 元字符
最后更新于:2022-03-26 22:08:45
JavaScript RegExp . 元字符
JavaScript RegExp 对象
定义和用法
. 元字符用于查找单个字符,除了换行和行结束符。
语法
new RegExp(“regexp.”)
或者更简单方式:
/regexp./
浏览器支持





所有主要浏览器都支持 . 元字符
实例
实例
对字符串中的 “h.t” 进行全局搜索:
var str=”That’s hot!”;
var patt1=/h.t/g;
下面被标记的文本显示了表达式获得匹配的位置
That‘s hot!
尝试一下 »
JavaScript RegExp 对象