Re: Search for underscore w/ LIKE

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: brianb-pgsql(at)edsamail(dot)com, pgsql-sql(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Search for underscore w/ LIKE
Date: 2000-07-08 00:09:12
Message-ID: Pine.LNX.4.21.0007072221180.587-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane writes:

> Exercise for the student: if you need to match a literal backslash
> in a LIKE pattern, how many backslashes do you have to write in your
> query?

I like how Python handles this: You prefix the text literal with an `r'
(as in "raw") and the backslashes are not special. Maybe we could offer
that as well.

blah ~ r'.+\..+'

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2000-07-08 00:16:18 Re: Re: [SQL] Re: [GENERAL] lztext and compression ratios...
Previous Message Peter Eisentraut 2000-07-08 00:09:02 Re: Altnerate Column Return Names