Indy, parsing and regular expressions

Giganews Newsgroups
Subject: Indy, parsing and regular expressions
Posted by:  Luigi Sandon (…@sandon.it)
Date: Mon, 7 Feb 2005

I see a lot of Indy code uses Pos() or the like to parse data. Why don't you
use regular expression that are far more flexible?

For example, in TIdMIMEBoundary.FindBoundary(AContentType: string): string;
I see (Indy 10)

  {CC: Used to Fetch 'BOUNDARY=', but this failed for those with 'BOUNDARY
='}
  Fetch(s, 'BOUNDARY'); {do not localize}

A regex would have easily allowed for both matches. Surely a regex engine
would add some code to Indy and it is slower, but it would also improve
parsing a lot, especially for complex expressions, IMHO.

--
Luigi D. Sandon
…@sandon.it

Replies