Skip to content

Instantly share code, notes, and snippets.

@davidbella
Created October 30, 2013 18:22
Show Gist options
  • Select an option

  • Save davidbella/7237461 to your computer and use it in GitHub Desktop.

Select an option

Save davidbella/7237461 to your computer and use it in GitHub Desktop.

Revisions

  1. davidbella created this gist Oct 30, 2013.
    14 changes: 14 additions & 0 deletions lcc_ar_migration.regex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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)