今天小明问了我一个正则表达式的问题,看不懂,突然想起以前看到过一个网站
http://jex.im/regulex/
真是一个神奇的网站,
在此附上github地址
https://github.com/JexCheng/regulex
----------我是萌萌哒参考线----------
JavaScript正则表达式解析器和可视化。
Visualizer : http://jex.im/regulex/
特性:
- 采用纯JavaScript编写。不需要后端。
- 在你自己的网站通过HTML iframe元素嵌入图形。
- 详细的错误信息。在大多数情况下,它可以指出的精确语法错误的位置。
- 没有对八进制转义支持. Yes it is a feature. ECMAScript strict mode doesn't support octal escape in string,but many browsers still support octal escape in regex. I make things easier. In regulex, DecimalEscape will always be treated as back reference. If the back reference is invalid, e.g.
/\1/
、/(\1)/
、/(a)\2/
,or DecimalEscape appears in charset(because in this case it can't be explained as back reference, e.g./(ab)[\1]/
). Regulex will always throw an error.
API:
var parse = require('regulex/parse');
var re = /var\s+([a-zA-Z_]\w*);/ ;
console.log(parse(re));
![qq截图20141126215431.png qq截图20141126215431.png](https://i-blog.csdnimg.cn/blog_migrate/c3a2d7b84197dae2499b087d9f62f7c4.png)