Skip to content

Instantly share code, notes, and snippets.

View EthanRutherford's full-sized avatar
💭
Working on solitaire

Ethan Rutherford EthanRutherford

💭
Working on solitaire
View GitHub Profile
@EthanRutherford
EthanRutherford / readme.md
Last active October 9, 2020 04:04
Regex but better

RegexButBetter

changes:

  • whitespace is no longer meaningful, and can therefore be used for formatting
    • this means whitespace must be escaped, using existing constructs like \n, \t, and a new escape for singleSpace \ (exact recipe open for discussion)
  • (capture) group constructs are totally rearranged, to allow for easier non-capturing grouping and reduction of "symbol soup" of current regex patterns
    • non-capturing group is assigned the bare ( so that the easiest-to-type grouping construct does not capture, and pollute the capture result array
      Motivation: using (?: just to be able to | a few options looks nasty
    • lookahead and lookbehind are modified to remove inconsistencies that exist for legacy, backward-compatibility reasons
  • (>= = positive lookahead