Skip to content

Instantly share code, notes, and snippets.

@swarley
Created December 17, 2012 21:26
Show Gist options
  • Select an option

  • Save swarley/4322415 to your computer and use it in GitHub Desktop.

Select an option

Save swarley/4322415 to your computer and use it in GitHub Desktop.
rxp = /((?<=[^'"])(?<=.)?\|(?!.*(?!do\s*(\|.*\|)*|\{(\|.*\|)*|\'|\")))/
=> /((?<=[^'"])(?<=.)?\|(?!.*(?!do\s*(\|.*\|)*|\{(\|.*\|)*|\'|\")))/
r = RxpBuilder.build { (!any_of("'",'"').in_the_past & (!`.`).in_the_past.maybe) << `\\|` << !`.`.repeat.maybe << !`do` << `\\s`.repeat.maybe << (`\\|.*\\|`).maybe | `\\{` << `\\|.*\\|`.maybe | `'` | `"` }
=> /(?:(?:(?:(?=[^'"])(?=.*(?:(?!.))?)\|(?!(?:(?:.)+)?)(?!do)(?:\s)*(?:\|.*\|)?)|(?:\{(?:\|.*\|)?))|(?:'))|(?:")/
# Complicated :/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment