Skip to content

Instantly share code, notes, and snippets.

@dmoulton
Created November 15, 2011 21:14
Show Gist options
  • Save dmoulton/1368369 to your computer and use it in GitHub Desktop.
Save dmoulton/1368369 to your computer and use it in GitHub Desktop.
Regular expression challenge
I need a regular expression that matches the word 'do' on this line:
things.each do |x|
but not on this line:
x = "do your worst"
Specifically, I'd like to match on the word 'do' only when it is NOT followed by a quote character later on the same line.
Answers in comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment