在放入RegEx之前应该转义的所有字符的列表? [英] List of all characters that should be escaped before put in to RegEx?

查看:118
本文介绍了在放入RegEx之前应该转义的所有字符的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可能不知道其中一些。

解决方案

看看PHP.JS实现PHP的 preg_quote 函数,应该做你所做的需要:


http:// phpjs。 org / functions / preg_quote:491


特殊的正则表达式字符是:。 \ + *? [^] $(){} =! < > | : -


Could someone please give a complete list of special characters that should be escaped?

I fear I don't know some of them.

解决方案

Take a look at PHP.JS's implementation of PHP's preg_quote function, that should do what you need:

http://phpjs.org/functions/preg_quote:491

The special regular expression characters are: . \ + * ? [ ^ ] $ ( ) { } = ! < > | : -

这篇关于在放入RegEx之前应该转义的所有字符的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆