Search Postgresql Archives

Re: What's wrong with this regexp?

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

 



Nick <nboutelier@xxxxxxxxx> wrote:

> SELECT TRUE WHERE '/steps/?step=10' ~ '^\/steps\/\?step=10$'

> Im guessing its an escape issue, but where am I going wrong?

You need to double-escape the question mark: Once for the
string literal, once for the regular expression (and you do
not need to escape the slashes). This gives:

| tim=# SELECT TRUE WHERE '/steps/?step=10' ~ E'^/steps/\\?step=10$';
|  bool
| ------
|  t
| (1 Zeile)

| tim=#

Tim


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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 Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux