# CodeMirror JavaScript-Integrated Regex Code Editor Demonstration

This demonstrates a parser in the regex folder which wraps the regular CodeMirror JavaScript editor and adds syntax coloring to regular expression literals in JavaScript.

var aVar = "aString" + 42 + aFunction(anArg, true); var myRgx = /test(group1|group2|(?:group3))and(group4)and(gr(ou)p5)/gi;

While the above styles by depth or sequence no matter the grouping type, this parser also allows styling distinctly by grouping type (capturing, named, non-capturing), while also still allowing alternating of colors within a type.

var aVar = "aString" + 42 + aFunction(anArg, true); var myRgx = /test(group1|group2|(?:group3))and(group4)and(gr(ou)p5)/gi;

One may also simply turn off the styling of content inside groups, allowing only individual tokens to be styled per the stylesheet (though the parentheses tokens themselves can still indicate depth or sequence):

var aVar = "aString" + 42 + aFunction(anArg, true); var myRgx = /test(group1|group2|(?:group3))and(group4)and(gr(ou)p5)/gi;