检查javascript中正则表达式的格式 [英] check format of regular expression in javascript

查看:69
本文介绍了检查javascript中正则表达式的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个正则表达式,我想检查这个正则表达式是否有效(格式正确)。



我尝试使用下面的代码检查但运行不好

Hi All,

I have a regular expression and I want to check this regular expression is valid or not(correct format).

I try to use this code as below to check but it run not good

var regExp = new RegExp();
regExp.compile("^[\d\-]{0,64}");  => check OK.
regExp.compile("[[\d\-]{0,64}");  => check Not Good.



请帮我处理这个案子。



提前谢谢。


Please help me handle this case.

thanks in advance.

推荐答案

你应该试试这个:

https://www.debuggex .com / [ ^ ]
You should try this:
https://www.debuggex.com/[^]


这篇关于检查javascript中正则表达式的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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