| From: | Erik Jones <erik(at)myemma(dot)com> | 
|---|---|
| To: | Matthew <mboehm(at)voilaip(dot)com> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: String Escaping in Pattern Matching | 
| Date: | 2007-08-27 23:14:08 | 
| Message-ID: | D2E9CB84-F2D6-4732-9FB3-8CB3AE928EB4@myemma.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Aug 27, 2007, at 5:29 PM, Matthew wrote:
> Hey gang,
>  I have three possible inputs:
>
>    18005551212
>    +18005551212
>    8005551212
>
> Right now I am using this to strip off the +, 1, or +1:
>
> INSERT INTO ... VALUES(SUBSTRING(usernumber FROM '^\\+?1?(.*)'));
>
> This works perfect but I get all of these in the log:
>
> WARNING:  nonstandard use of \\ in a string literal at character 181
>
> If I change to this as per the doc example right above the 9.7.3  
> header
> on this page:
>   http://www.postgresql.org/docs/8.2/static/functions-matching.html
>
> SUBSTRING(usernumber FROM '^#+?1?(.*)' FOR '#')
>
> I get NULL inserted but no WARNING's.
>
> A point if the right direction would be appreciated.
Try
INSERT INTO ... VALUES(SUBSTRING(usernumber FROM E'^\\+?1?(.*)'));
Erik Jones
Software Developer | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kamil Srot | 2007-08-27 23:14:20 | Re: Tables dissapearing | 
| Previous Message | Markus Schiltknecht | 2007-08-27 23:13:05 | Re: Geographic High-Availability/Replication |