pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
OT - Validating Regular Expression in java
2+ messages / 2 participants
[nested] [flat]

* OT - Validating Regular Expression in java
@ 2004-11-04 15:07  David Gagnon <dgagnon@siunik.com>
  0 siblings, 1 reply; 2+ messages in thread

From: David Gagnon @ 2004-11-04 15:07 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,

  I know it's not directly the purpose of this list, so I apologize, but 
I think you guys are the ones who can help me :-)

My web site offers a search which supports regular expression (POSIX).  
I'm looking for a way to validate the regular expression in the 
application before sending it the the DB.  For now Postgresql throwing 
an error on invalid regular expression.

I tried with  the gnu-regexp frameworks,  It works partly but it's not 
full proof since an invalid caracter class like  [[:awefaewf:]]* is not 
flagged as an error but causes an error with Postgresql.

Any help on this matter will be appreciated.  I'm sure it's a common 
problem and have been addressed before ... I searched but haven't found 
the answer yet.

Thanks for your help

/David

I



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: OT - Validating Regular Expression in java
@ 2004-11-04 15:40  Kris Jurka <books@ejurka.com>
  parent: David Gagnon <dgagnon@siunik.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2004-11-04 15:40 UTC (permalink / raw)
  To: David Gagnon <dgagnon@siunik.com>; +Cc: pgsql-jdbc



On Thu, 4 Nov 2004, David Gagnon wrote:

> I think you guys are the ones who can help me :-)
> 
> My web site offers a search which supports regular expression (POSIX).  
> I'm looking for a way to validate the regular expression in the 
> application before sending it the the DB.  For now Postgresql throwing 
> an error on invalid regular expression.

I'd say just go ahead and send it to the db.  Getting a java regex package 
to match up *exactly* with pg's seems rather unlikely.  Why not just let 
pg tell you if it was valid or not?  I'm guessing you want to detect regex 
errors from other sql errors, but SQLException.getSQLState() should do 
that for 7.4+ servers.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-11-04 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-04 15:07 OT - Validating Regular Expression in java David Gagnon <dgagnon@siunik.com>
2004-11-04 15:40 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox