re : [HACKERS] Prob with regexp

2001-03-26 Thread pejac

Hi,

There's no bug with regexp, because "*" operator in
regex match zero or more times. So if you want
match exactly your patern try ~ 'ibd01.*' . "." match an
arbitrary character.

Cheers,

PEJAC Pascal


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[HACKERS] Prob with regexp

2001-03-25 Thread Philippe Rochat

I think there is a prob with regexp, which is comparing one less
character as it should. Below is an example. Result is that last
character is omitted !

Ph.R.

postgres=# select * from pg_database where datname ~ 'ibd01*';
 datname | datdba | encoding | datpath 
-++--+-
 ibd00_8 |505 |0 | ibd00_8
 ibd00_1 |505 |0 | ibd00_1
 ibd00_2 |505 |0 | ibd00_2
 ibd00_3 |505 |0 | ibd00_3
 ibd00_4 |505 |0 | ibd00_4
 ibd00_5 |505 |0 | ibd00_5
 ibd00_6 |505 |0 | ibd00_6
 ibd00_7 |505 |0 | ibd00_7
 ibd00_9 |505 |0 | ibd00_9
 ibd01_1 |505 |0 | ibd01_1
 ibd01_2 |505 |0 | ibd01_2
 ibd01_3 |505 |0 | ibd01_3
 ibd01_4 |505 |0 | ibd01_4
 ibd01_5 |505 |0 | ibd01_5
(14 rows)

postgres=# select * from pg_database where datname ~ 'ibd01_*';
 datname | datdba | encoding | datpath 
-++--+-
 ibd01_1 |505 |0 | ibd01_1
 ibd01_2 |505 |0 | ibd01_2
 ibd01_3 |505 |0 | ibd01_3
 ibd01_4 |505 |0 | ibd01_4
 ibd01_5 |505 |0 | ibd01_5
(5 rows)

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [HACKERS] Prob with regexp

2001-03-25 Thread Tom Lane

Philippe Rochat [EMAIL PROTECTED] writes:
 I think there is a prob with regexp, which is comparing one less
 character as it should. Below is an example. Result is that last
 character is omitted !

Possibly there is a problem with your understanding of regexp patterns
... but all those matches look valid to me.  See
http://www.postgresql.org/devel-corner/docs/postgres/functions-matching.html
for more info.

regards, tom lane

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [HACKERS] Prob with regexp

2001-03-25 Thread Peter Eisentraut

Philippe Rochat writes:

 I think there is a prob with regexp, which is comparing one less
 character as it should. Below is an example. Result is that last
 character is omitted !

A '*' means "zero or more of the preceeding character".  You probably want
a '+'.


 Ph.R.

 postgres=# select * from pg_database where datname ~ 'ibd01*';
  datname | datdba | encoding | datpath
 -++--+-
  ibd00_8 |505 |0 | ibd00_8
  ibd00_1 |505 |0 | ibd00_1
  ibd00_2 |505 |0 | ibd00_2
  ibd00_3 |505 |0 | ibd00_3
  ibd00_4 |505 |0 | ibd00_4
  ibd00_5 |505 |0 | ibd00_5
  ibd00_6 |505 |0 | ibd00_6
  ibd00_7 |505 |0 | ibd00_7
  ibd00_9 |505 |0 | ibd00_9
  ibd01_1 |505 |0 | ibd01_1
  ibd01_2 |505 |0 | ibd01_2
  ibd01_3 |505 |0 | ibd01_3
  ibd01_4 |505 |0 | ibd01_4
  ibd01_5 |505 |0 | ibd01_5
 (14 rows)

 postgres=# select * from pg_database where datname ~ 'ibd01_*';
  datname | datdba | encoding | datpath
 -++--+-
  ibd01_1 |505 |0 | ibd01_1
  ibd01_2 |505 |0 | ibd01_2
  ibd01_3 |505 |0 | ibd01_3
  ibd01_4 |505 |0 | ibd01_4
  ibd01_5 |505 |0 | ibd01_5
 (5 rows)


-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html