Visual Studio Code syntax highlighter for Steve Levithan's Regex+ library, "a template tag for readable, high-performance, native JS regexes with extended syntax, context-aware interpolation, and always-on best practices".
This extension highlights Regex+ template strings in JavaScript and TypeScript source files, including their React flavours.
You can also create and edit .regex+ files, their full text is considered a regular expression source. This may help in writing very complex expressions that you can later copy and paste in your JS/TS code (or even read from disk then feed to Regex+).
Be sure to read the docs if you're not familiar with Regex+.
Regex+ is an astonishing piece of software. I highly recommend it if you want to be serious about regexes.
None yet.
Although the full regular expression syntax Regex+ brings is supported, not all its features are yet implemented.
For now, the following restrictions apply:
-
Only the
regex,regex(flags)andpatterntagged templates are highlighted. Theregex(options)variant and therewriteutility function are not.- To call
regexwith options and still have your regex syntax highlighted, either make it start with#regexor#rx, or prefix the actual template with/* regex */:
// With embedded start comment: const re = regex(options)`#rx ... ` // With prefix comment: const re = regex(options)/* regex */` ... `
- To call
-
Only the main Regex+ package is supported. The additional syntax brought by the recursion plugin (
(?R=N),\g<name&R=N>and\g<number&R=N>) is not. -
You cannot alias the imports, they have to be named
regexandpattern.- This is a limitation of the TextMate engine VS Code uses to syntax highlight code. If you really want to alias the functions (e.g.,
import { regex as regexplus } from 'regex'), you can still use the comment trick described above.
- This is a limitation of the TextMate engine VS Code uses to syntax highlight code. If you really want to alias the functions (e.g.,
Work is still in progress and the missing features will be implemented gradually.
This project wouldn't have been possible without the help and support from the following people:
- @slevithan - Author of Regex+
- @RedCMD - TextMate guru
Thanks, guys!


