pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
select ... from ... where ... ~* 'C++'
3+ messages / 3 participants
[nested] [flat]

* select ... from ... where ... ~* 'C++'
@ 1999-09-04 14:33 Martin Dolog <dolog@mcprogress.com>
  1999-09-04 17:38 ` Re: [SQL] select ... from ... where ... ~* 'C++' tjk@tksoft.com <tjk@tksoft.com>
  1999-09-06 15:59 ` Re: [SQL] select ... from ... where ... ~* 'C++' Herouth Maoz <herouth@oumail.openu.ac.il>
  0 siblings, 2 replies; 3+ messages in thread

From: Martin Dolog @ 1999-09-04 14:33 UTC (permalink / raw)
  To: pgsql-sql


hi *,

PLease, how can I make case insensitive query
which work with string like 'C++' too ?

select something from something_t where some ~* 'C++'

doesn't work!
I got following error message:

"ERROR:  regcomp failed with error repetition-operator operand invalid"


I am running on Linux/Redhat6/postgresql6.5 compiled
with --enable-locale flag.


Thank you very much for help.



	Martin

-- 

#md



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] select ... from ... where ... ~* 'C++'
  1999-09-04 14:33 select ... from ... where ... ~* 'C++' Martin Dolog <dolog@mcprogress.com>
@ 1999-09-04 17:38 ` tjk@tksoft.com <tjk@tksoft.com>
  1 sibling, 0 replies; 3+ messages in thread

From: tjk@tksoft.com @ 1999-09-04 17:38 UTC (permalink / raw)
  To: dolog@mcprogress.com; +Cc: pgsql-sql

Martin,

Try 

select something from something_t where some ~* 'C[+][+]'

or rather, 

select something from something_t where some like '%C++%'

Troy


> 
> 
> hi *,
> 
> PLease, how can I make case insensitive query
> which work with string like 'C++' too ?
> 
> select something from something_t where some ~* 'C++'
> 
> doesn't work!
> I got following error message:
> 
> "ERROR:  regcomp failed with error repetition-operator operand invalid"
> 
> 
> I am running on Linux/Redhat6/postgresql6.5 compiled
> with --enable-locale flag.
> 
> 
> Thank you very much for help.
> 
> 
> 
> 	Martin
> 
> -- 
> 
> #md
> 
> ************
> 
> 




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] select ... from ... where ... ~* 'C++'
  1999-09-04 14:33 select ... from ... where ... ~* 'C++' Martin Dolog <dolog@mcprogress.com>
@ 1999-09-06 15:59 ` Herouth Maoz <herouth@oumail.openu.ac.il>
  1 sibling, 0 replies; 3+ messages in thread

From: Herouth Maoz @ 1999-09-06 15:59 UTC (permalink / raw)
  To: Martin Dolog <dolog@mcprogress.com>; pgsql-sql

At 17:33 +0300 on 04/09/1999, Martin Dolog wrote:


> PLease, how can I make case insensitive query
> which work with string like 'C++' too ?
>
> select something from something_t where some ~* 'C++'

You should read the manual page for regex - it explains which characters
are special in a regular expression. In principle, you should add two
backslashes before each special character, like '.', '*', '+', '?', '[' etc.

SELECT something FROM something_t WHERE some ~* 'C\\+\\+';

If you are wondering why *two* backslashes... Well... If you put one
backslash, it tells postgres that the next character is to be taken
literally. Thus, if your string is 'C\+\+', it will pass 'C++' to the
regexp level, because the parsing of the string is done before passing them
to the regexp function.

Using two backslashes, the first backslash passes the second literally, so
the regexp function gets 'C\+\+'. It then knows that the pluses are not to
be considered special.

Passing a backslash, I suspect, requires writing no less than four
backslashes in the query...

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1999-09-06 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-09-04 14:33 select ... from ... where ... ~* 'C++' Martin Dolog <dolog@mcprogress.com>
1999-09-04 17:38 ` tjk@tksoft.com <tjk@tksoft.com>
1999-09-06 15:59 ` Herouth Maoz <herouth@oumail.openu.ac.il>

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