News for hackers. Stuff that matters.
Re:Simple Helper to Extract Values from a String by jdwhit2 on Thursday October 04, 2012 @06:00AM (#4611601)
This examples looks like it covers a large number of cases:

      extractValues('John Doe <[email protected]> (http://example.com)', '{name} <{email}> ({url})')
    >> {'name': 'John Doe', 'email': '[email protected]', 'url': 'http://example.com' }
What kinds of problems would you run into vs using regex? My thoughts were that you lose some control of your matches.
Re:Simple Helper to Extract Values from a String by keeperofdakeys on Thursday October 04, 2012 @07:41AM (#4611826)
You lose the ability to write them quickly, which considering I mainly use them for code editing or one-off uses, is quite important. The thing about regular expressions is they aren't suited to general programming in their normal form (since they are hard to read, and slow), and the quoted example is better described as a general parser, and could be implemented much better directly then abstracting through regular expressions.