Обсуждение: RE in WHERE

Поиск
Список
Период
Сортировка

RE in WHERE

От
Patrick Nelson
Дата:
SELECT * FROM secure WHERE ~ '^12\.';

displays

    host
-----------------
 12.28.18.10
 12.41.17.174
 128.121.247.126
...

Escaping the dot should only show the 12. entries right?  What is the proper
RE for this?

Re: RE in WHERE

От
Jean-Luc Lachance
Дата:
Double up on the back slashes.

SELECT * FROM secure WHERE ~ '^12\\.'


Patrick Nelson wrote:
>
> SELECT * FROM secure WHERE ~ '^12\.';
>
> displays
>
>     host
> -----------------
>  12.28.18.10
>  12.41.17.174
>  128.121.247.126
> ...
>
> Escaping the dot should only show the 12. entries right?  What is the proper
> RE for this?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Re: RE in WHERE

От
Jeff Eckermann
Дата:
--- Patrick Nelson <pnelson@neatech.com> wrote:
> SELECT * FROM secure WHERE ~ '^12\.';
>
> displays
>
>     host
> -----------------
>  12.28.18.10
>  12.41.17.174
>  128.121.247.126
> ...
>
> Escaping the dot should only show the 12. entries
> right?  What is the proper
> RE for this?
>
Your statement goes through two rounds of parsing,
with escape characters being stripped off each time,
so your literal '.' is being interpreted as a
metacharacter.  Try doubling your backslash escape.

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

Re: RE in WHERE

От
Joe Maldonado
Дата:
try this...
    select * from secure where  ~'^12[.]';

Joe Maldonado
On Thu, 2002-10-10 at 15:13, Patrick Nelson wrote:
> SELECT * FROM secure WHERE ~ '^12\.';
>
> displays
>
>     host
> -----------------
>  12.28.18.10
>  12.41.17.174
>  128.121.247.126
> ...
>
> Escaping the dot should only show the 12. entries right?  What is the proper
> RE for this?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



Re: RE in WHERE

От
Patrick Nelson
Дата:
Jean-Luc Lachance wrote:
----------------->>>>
Double up on the back slashes.

SELECT * FROM secure WHERE ~ '^12\\.'
----------------->>>>
That didn't work either...