4 ms·
It's very disappointing to find the author didn't mention greedy matchers. Consider the difference: >> s = "hello world, I love you world" >> s.sub(/(.*?)w
by snitko 16y ago
It's very disappointing to find the author didn't mention greedy matchers. Consider the difference:
>> s = "hello world, I love you world"
>> s.sub(/(.*?)world/, '\1universe')
=> "hello universe, I love you world"
>> s.sub(/(.*)world/, '\1universe')
=> "hello world, I love you universe"
- samdk 16y agoThose are in the next article in the series, which is linked from the bottom of this one: http://immike.net/blog/2007/06/21/extreme-regex-foo-what-you-need-to-know-to-become-a-regular-expression-pro/ http://immike.net/blog/2007/06/21/extreme-regex-foo-what-you....