Do you regularly post regular expressions online? Have you seen the regex syntax highlighting in RegexPal
, or on my blog (example
), and wanted to apply it to your own websites?
Prompted by blog reader Mark McDonnell
" class. You can see an example of doing just that on my quick and dirty test page
is backreference 10, backreference 1 followed by a literal zero, octal character index 10, or something else altogether due to its position in the surrounding pattern. Speaking of octal escapes (which are de facto browser extensions; not part of the spec.), they are correctly highlighted according to their subtle differences inside and outside character classes (outside of character classes only, octals can include a fourth digit if the leading digit is a zero).
an overhaul if you want to cleanly add support for additional regex flavors. Another nifty feature I plan to eventually add is explanatory
attributes for each element in the returned HTML, which might be particularly helpful for deciphering any highlighted errors or warnings.
Let me know if this library is useful for you, or if there are any other features you'd like to see added or changed. Thanks!