[tpm] I wish I was better at regex's

J. Bobby Lopez jbl at jbldata.com
Wed Mar 9 13:36:38 PST 2011


Agreed, but in the event that you don't have a strict format for comments
and key/value pairs (quotes/no quotes; comments with special
characters/without), then you're still looking for the last instance of ';'
outside of last (possible) quote, no?

On Wed, Mar 9, 2011 at 4:30 PM, Uri Guttman <uri at stemsystems.com> wrote:

> >>>>> "JBL" == J Bobby Lopez <jbl at jbldata.com> writes:
>
>  JBL> I would expect that you can just count the number of ';'
>  JBL> instances in the string, and get the index of the last instance
>  JBL> which resides after the last instance of the last single or
>  JBL> double quote.  If there are no quotes, then it's the first
>  JBL> instance of ';'.
>
> that is backwards. it is much simpler to parse forwards. this is old
> school stuff that is done in assemblers and similar syntaxes with
> optional fields on a line. you scan allowed fields from left to right
> and it all is easy.
>
> uri
>
> --
> Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com--
> -----  Perl Code Review , Architecture, Development, Training, Support
> ------
> ---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com---------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20110309/89c1bab0/attachment.html>


More information about the toronto-pm mailing list