This article was originally posted in my personal blog: http://jerryzou.com/posts/jreparser/
Yesterday, while watching the 30-minute introductory tour of regular expressions, I saw that the blogger himself implemented a C#
regular tester that looked very handy. But I don't really like to mess around, so I'm wondering if I can implement a javascript
regular expression tester myself. So dozens of lines of code implemented such a regular tester.
Let's show you the 0.1 version.
The page is also relatively simple, but the basic features are. can be used normally ~.
The process of extracting a regular expression from a user's input thanks to the @依云
great God Point (Portal), the following solutions are available:
R is the user input string var jtester = function (r) { var begin = R.indexof ('/'); var end = R.lastindexof ('/'); var flags = R.match (/\/([igm]{0,3}) $/i) [1]; THIS.R = new RegExp (r.substring (begin + 1, end), flags);};
If there's any better idea, you can always talk to me, or simply fork the repo I created on GitHub and pull request~. (Portal for Project on GitHub)
Finally, the address of this test tool is attached: http://zry656565.github.io/JRE-Parser/
Your own implementation of an online JavaScript regular expression tester--jre-parser