At 10:57 PM -0400 4/4/06, Daniel F. Savarese wrote:
In message <[EMAIL PROTECTED]>, "Mark F. Murphy" writes:
It also came to mind that it might be kind of nice to bundle some
very common expressions which would be useful for others.

Sounds good to me.  They'd also make a good basis for unit tests.
What's a good way to include them?  String constants in a singleton?

That would be one way.

However, for some difficult regex's, there might need to be some support methods in order to make them readily usable.

For example, the CSV regex I did requires a 5 group match because of the various conditions which might exist:

1) quoted field
2) quoted field had sep term
3) non-quoted field
4) non-quoted field had sep term
5) empty field

The "had sep term" is only needed to check the last field for being empty.

So while the regex is a big part of the CSV parser, without a little support code using it, someone might have a difficult time getting out of it what they ultimately want... an array of fields from a parsed CSV line.

Of course, the raw regex is certainly good for people who need something just to look at in order to handle their own custom needs and get them going.

mark

--
---------------------------------------------------------------------------
 Mark F. Murphy, Director Software Development   <mailto:[EMAIL PROTECTED]>
 Tyrell Software Corp                            <http://www.tyrell.com>
---------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to