Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created September 20, 2011 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ingydotnet/1228947 to your computer and use it in GitHub Desktop.
Save ingydotnet/1228947 to your computer and use it in GitHub Desktop.
# one or more words separated by commas
rule: /(<WORD>+)/ ** /~<COMMA>~/
text:
- "I, like, pie"
- "I"
# zero or more words separated by commas
rule: /(<WORD>+)/ ?** /~<COMMA>~/
text:
- "I, like, pie"
- "I"
- ""
# zero or more, trailing comma ok
rule: /(<WORD>+)/ ?**? /~<COMMA>~/
text:
- "I, like, pie"
- "I, like, pie,"
- "I"
- "I,"
- ""
- "," # Not sure about this
# two or more terms separated by pipes
rule: /(<WORD>+)/ +** /~<PIPE>~/
text:
- "foo | bar"
- "foo | bar | baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment