jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark F. Murphy" <ma...@tyrell.com>
Subject Re: expression bundle
Date Wed, 05 Apr 2006 13:31:10 GMT
At 10:57 PM -0400 4/4/06, Daniel F. Savarese wrote:
>In message <p06230906c055a3265f18@[10.0.1.2]>, "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:markm@tyrell.com>
  Tyrell Software Corp                            <http://www.tyrell.com>
---------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: oro-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: oro-dev-help@jakarta.apache.org


Mime
View raw message