-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: parameter containing a regex
PostPosted: Fri Mar 06, 2009 12:40 pm 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
hi,

i try to execute an update containing a regex. im using postgres 8.2 and hibernate 3.3.1.ga

the correct syntax for a postgres regex containing backreferences would be:

update foo set bar = 1 where foobar ~* E'(foo)\\1\\1'
the "E" means "escape"

and no, the like - keyword wouldnt be enough for complicated regex.

it may look strange, but its the only way i could get the backreferences work correctly.

now using a hibernate native query im having problems to use the "E".

solution 1 would be to concatenate the whole sql, but since "{" is a reserved character this wont work for some regex..

solution 2 would be using named parameters, but this wont work because i cant use the escape character "E":
update foo set bar = 1 where foobar ~* E:expr
obviously wont work..

so what should i do?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.