[dev] regex gurus listen

Jan Schneider janmailing@gmx.de
Thu, 12 Jul 2001 17:28:07 +0000


Zitat von "Brent J. Nordquist" <bjn@horde.org>:

> On Thu, 12 Jul 2001, Jan Schneider <janmailing@gmx.de> wrote:
> 
> > Take this line (remove linebreaks):
> > ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-
> > TO="Mailto:E@example.com":Mailto:C@example.com
> >
> > It has to be split at the first occuring colon _not_ in quoted string.
> > In this case it has to be split at colon before the 2nd 'Mailto'.
> 
> I'm not sure you can do that in a completely general way with only one
> regex.  Are there any other constraints that would narrow the problem?
> Is the above format always the way it will be (one set of double-quoted
> "something", that could be removed with a first pass)?  Do you need all

No.

> the fields that you're splitting, or only the one you mentioned?

Both.

> - You could change all the :'s inside ""'s to be some other character,
> then split it, then change them back.

That sounds like a good idea. I think I will try this.

> - You could use a pattern that would grab from the right, if you know
> there won't be any ""'s to the right of the part you need broken out.

I don't know. Actually it'll happen even more often that quoted string appear 
at the right part.

Thanks for your inspiration,
Jan.