Re: Search for underscore w/ LIKE - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Search for underscore w/ LIKE
Date
Msg-id Pine.LNX.4.21.0007072221180.587-100000@localhost.localdomain
Whole thread Raw
In response to Re: Search for underscore w/ LIKE  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Altnerate Column Return Names
Next
From: Forest Wilkinson
Date:
Subject: How to get a self-conflicting row level lock?