JavaScript正则表达式解析器和可视化:Regulex
jopen
10年前
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));