You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Warren <wa...@clarksnutrition.com> on 2007/06/30 04:26:45 UTC

regex in WHERE clause

I am trying to get the following to work:

<![CDATA[SELECT * FROM table WHERE substring(trim(field8) from '....$') 
~ '[1-9][0-9]\\.[0-9]$']]>

It does not work but this will:

<![CDATA[SELECT * FROM table WHERE substring(trim(field8) from 'a') ~ 'a']]>

When I place the $ character in it it breaks. Do I need to be doing some 
sort of escaping. The top statement works fine when I run it in pgamin.


-- 
Thanks,

Warren Bell

Re: regex in WHERE clause

Posted by Larry Meadors <lm...@apache.org>.
Use $$ instead.

On 6/29/07, Warren <wa...@clarksnutrition.com> wrote:
> I am trying to get the following to work:
>
> <![CDATA[SELECT * FROM table WHERE substring(trim(field8) from '....$')
> ~ '[1-9][0-9]\\.[0-9]$']]>
>
> It does not work but this will:
>
> <![CDATA[SELECT * FROM table WHERE substring(trim(field8) from 'a') ~ 'a']]>
>
> When I place the $ character in it it breaks. Do I need to be doing some
> sort of escaping. The top statement works fine when I run it in pgamin.
>
>
> --
> Thanks,
>
> Warren Bell
>