JS正则匹配console,包括换行、空格、分号

时间:2026-02-15 19:27:10

1、匹配console,无论是log、error、waring等

console\..*\(([\s\S]*?)\)(;?)

2、匹配console.log

console\.log\(([\s\S]*?)\)(;?)

3、匹配console.error

console\.error\(([\s\S]*?)\)(;?)

4、要匹配其它的很简单,如图示把图中的“.*”替换成任意的属性名

JS正则匹配console,包括换行、空格、分号

© 2026 途途旅游
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com