Last active
September 9, 2016 16:59
-
-
Save jhyland87/5793714cfa1d2f30215fd83912363bdb to your computer and use it in GitHub Desktop.
Evolution of the RegExp pattern for the macro used in the xls-to-sql script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\{(?P<noun>(?:cols?|range))\:(?:(?<=col:)(?P<col>(?:[a-zA-Z]+|[0-9]+))|(?<=cols:)(?P<cols>(?:[a-zA-Z0-9\-\,]+))|(?<=range:)(?P<col_start>(?:[a-zA-Z]+|[0-9]+))\-(?P<col_stop>(?:[a-zA-Z]+|[0-9]+)))\}(?P<modifier>(?:[\?\!]))? | |
\{ (?# Opening delimiter match) | |
(?P<noun>(?:cols?|range)) (?# Match the noun (col, cols, or range)) | |
\: | |
(?: | |
(?<=col:) (?# Look-behind conditional for the 'col' noun) | |
(?P<col>(?:[a-zA-Z]+|[0-9]+)) (?# Creates named group 'col' with either alpha or numeric value(s) (but not both)) | |
| | |
(?<=cols:) (?# Look-behind conditional for the 'cols' noun) | |
(?P<cols>(?:[a-zA-Z0-9\-\,]+)) (?# Creates named group 'cols' with a comma delimited list of columns) | |
| | |
(?<=range:) (?# Look-behind conditional for the 'range' noun) | |
(?P<col_start>(?:[a-zA-Z]+|[0-9]+)) (?# Creates named group 'col_start' with the beginning range number/letter) | |
\- | |
(?P<col_stop>(?:[a-zA-Z]+|[0-9]+)) (?# Creates named group 'col_stop' with the ending range number/letter) | |
) | |
\} (?# Closing delimiter match) | |
(?P<modifier>(?:[\?\!]))? (?# Check for the modifier (? means its optional, ! means its required)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment