Dynamic Regex Highlighting with Javascript!

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
ridgerunner
Forum Contributor
Posts: 214
Joined: Sun Jul 05, 2009 10:39 pm
Location: SLC, UT

Dynamic Regex Highlighting with Javascript!

Post by ridgerunner »

I've written a new Javascript utility that adds dynamic regex syntax highlighting to regular expressions displayed on any web page. When you hover your mouse cursor over any grouping parentheses, the matching parentheses and any | OR characters at that nesting level will light up so that you can visually see the regex structure. It will also highlight character classes and comments. The script source code is released as open source and is hosted on Github. If you into regex, I think you'll agree - its pretty cool. Here are the links:

Main page:
http://jmrware.com/.../DynamicRegexHighlighter.html
Interactive Tester page:
http://jmrware.com/.../DynamicRegexHighlighterTester.html
Github repo:
http://github.com/jmrware/DynamicRegexHighlighter

One possibility for its use is to add a new [REGEX] BBcode to the forum software and then include the Javascript file to provide enhanced viewing of postings having regular expressions. This is precisely what I plan to do with the forum software project I'm involved with:(FluxBB)

Enjoy!
Jeff Roberson
:)
Post Reply