[tpm] I wish I was better at regex's
uri at StemSystems.com
Wed Mar 9 14:45:31 PST 2011
>>>>> "JBL" == J Bobby Lopez <jbl at jbldata.com> writes:
JBL> Then I suppose a rephrasing the question would be beneficial.
JBL> Instead of: "Strip comments from lines while obeying quoted
JBL> .. maybe:
JBL> "Rip key/value pairs from line, and disregard comments".
JBL> Which would put the focus on the key/val pairs (with an
JBL> opportunity to normalize them; convert them all to quoted values,
JBL> for example), instead of focusing on stripping the comments away.
sometimes rephrasing the problem helps a lot. in this case it didn't
matter to me once i saw the complex regexes being tossed about like hand
grenades! when that was happening it was obvious to me they were going
down the wrong path. as i said elsewhere, this is an old problem solved
long ago by parsing left to right with a proper parser (which can use
regexes!). the format is very similar to assembler code lines.
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the toronto-pm