Search Postgresql Archives

Re: Getting unexpected results from regexp_replace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Nessett <dnessett@xxxxxxxxx> writes:
> SELECT user_name, regexp_replace(user_email, E'\(.*\)', '') AS user_email, family_list, street_address, city, state, zip, phone_list, email_list
> FROM "household_data"
> WHERE email_list != ‘';

Because you used E'...', the backslashes are eaten by the string literal
parser.  So the pattern seen by regexp_replace() is just  '(.*)', in
which the parens are capturing parens not literal characters.  Thus it
matches the whole string.

Personally I'd leave off the E, but if you must use it then double the
backslashes.

			regards, tom lane






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux