pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedEscaping w/i regular expressions
4+ messages / 3 participants
[nested] [flat]
* Escaping w/i regular expressions
@ 1999-06-29 23:25 Peter Eisentraut <peter@pathwaynet.com>
0 siblings, 0 replies; 4+ messages in thread
From: Peter Eisentraut @ 1999-06-29 23:25 UTC (permalink / raw)
To: pgsql-sql
How do you escape a ' (apostrophe) within a regular expression, so it does
not close off the string? Something like
... ~ '[0-9.,\']'
does not seem to work.
(Pgsql 6.4.2)
Any ideas?
--
Peter Eisentraut
PathWay Computing
^ permalink raw reply [nested|flat] 4+ messages in thread
* Escaping w/i regular expressions
@ 1999-06-30 18:07 Peter Eisentraut <peter@pathwaynet.com>
0 siblings, 2 replies; 4+ messages in thread
From: Peter Eisentraut @ 1999-06-30 18:07 UTC (permalink / raw)
To: pgsql-sql
How do you escape a ' (apostrophe) within a regular expression, so it does
not close off the string? Something like
... ~ '[0-9.,\']'
does not seem to work.
(Pgsql 6.4.2)
Any ideas?
--
Peter Eisentraut
PathWay Computing
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] Escaping w/i regular expressions
@ 1999-07-04 11:09 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: Peter Eisentraut <peter@pathwaynet.com>
1 sibling, 0 replies; 4+ messages in thread
From: Herouth Maoz @ 1999-07-04 11:09 UTC (permalink / raw)
To: Peter Eisentraut <peter@pathwaynet.com>; pgsql-sql
At 21:07 +0300 on 30/06/1999, Peter Eisentraut wrote:
> How do you escape a ' (apostrophe) within a regular expression, so it does
> not close off the string? Something like
> ... ~ '[0-9.,\']'
> does not seem to work.
> (Pgsql 6.4.2)
Yes, it does work:
testing=> select * from test;
nm
-------------------------------------------------------
This is a regular sentence ending with a full stop.
In this sentence there is a 'quoted' word.
not a sentence
Fi, fye, foe, fam - I smell the blood of an Englishman.
There are 10,000 bottles of beer on the wall.
(5 rows)
testing=> select * from test where nm ~ '[0-9.,\']';
nm
-------------------------------------------------------
This is a regular sentence ending with a full stop.
In this sentence there is a 'quoted' word.
Fi, fye, foe, fam - I smell the blood of an Englishman.
There are 10,000 bottles of beer on the wall.
(4 rows)
See how it didn't match the 'not a sentence'? Now, to make sure, I removed
the '.' from your regular expression, so the only thing to match in the
'quoted' row was the quotes:
testing=> select * from test where nm ~ '[0-9,\']';
nm
-------------------------------------------------------
In this sentence there is a 'quoted' word.
Fi, fye, foe, fam - I smell the blood of an Englishman.
There are 10,000 bottles of beer on the wall.
(3 rows)
Convinced?
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] Escaping w/i regular expressions
@ 1999-07-08 02:18 Bruce Momjian <maillist@candle.pha.pa.us>
parent: Peter Eisentraut <peter@pathwaynet.com>
1 sibling, 0 replies; 4+ messages in thread
From: Bruce Momjian @ 1999-07-08 02:18 UTC (permalink / raw)
To: Peter Eisentraut <peter@pathwaynet.com>; +Cc: pgsql-sql
> How do you escape a ' (apostrophe) within a regular expression, so it does
> not close off the string? Something like
> ... ~ '[0-9.,\']'
> does not seem to work.
> (Pgsql 6.4.2)
>
Seems to work in 6.5:
test=> select * from test where x ~ '[acb\']';
x
-
'
(1 row)
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~1999-07-08 02:18 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-29 23:25 Escaping w/i regular expressions Peter Eisentraut <peter@pathwaynet.com>
1999-06-30 18:07 Escaping w/i regular expressions Peter Eisentraut <peter@pathwaynet.com>
1999-07-04 11:09 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-07-08 02:18 ` Bruce Momjian <maillist@candle.pha.pa.us>
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