Created
October 30, 2013 18:22
-
-
Save davidbella/7237461 to your computer and use it in GitHub Desktop.
Regex: Matches _lower_camel_case words for ActiveRecord migrations
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
http://regex101.com/r/mV8rA7 | |
/(?:_([^_.]+))+?/g | |
01_create_cats.rb | |
02_create_all_the_dogs.rb | |
/(?:_([^_.]+))+?/g | |
(?:_([^_.]+)) Non-capturing Group 1 to infinite times [lazy] | |
_ Literal _ | |
1st Capturing group ([^_.]+) | |
Negated char class [^_.] 1 to infinite times [greedy] matches any character except: | |
_. One of the following characters _. | |
g modifier: global. All matches (don't return on first match) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment