From: Simon Strandgaard Date: 2007-01-13T01:41:20+09:00 Subject: Re: DRY gsub... On 1/12/07, Simon Strandgaard wrote: > On 1/12/07, benjohn@fysh.org wrote: [snip] > > Out of interest, what does the ?: do in there? I've googled, etc, honest! > > (?: ) is a non-capturing group example if you want to match a repeating pattern, but don't want the repeating stuff in your output "abcde xyx xyx xyx abcde".scan(/(?:xyx ){2,}.*(b.*d)/) #=> [["bcd"]] if you use ( ) then it shows up in the output "abcde xyx xyx xyx abcde".scan(/(xyx ){2,}.*(b.*d)/) #=> [["xyx ", "bcd"]] -- Simon Strandgaard http://opcoders.com/