Created
December 12, 2011 09:21
-
-
Save fguillen/1466148 to your computer and use it in GitHub Desktop.
Revisions
-
fguillen created this gist
Dec 12, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # By default ReGex will match the bigest occurrence: ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+)_/) => [["one_ two _three"]] # But we can tell it to match all the smallest ones: ruby-1.9.2-p180 > "_one_ two _three_".scan(/_(.+?)_/) => [["one"], ["three"]]