Re: What's wrong with this regexp? - Mailing list pgsql-general

From Tim Landscheidt
Subject Re: What's wrong with this regexp?
Date
Msg-id m33a5qc25h.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to What's wrong with this regexp?  (Nick <nboutelier@gmail.com>)
List pgsql-general
Nick <nboutelier@gmail.com> 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

pgsql-general by date:

Previous
From: Nick
Date:
Subject: What's wrong with this regexp?
Next
From: merlyn@stonehenge.com (Randal L. Schwartz)
Date:
Subject: Re: What's wrong with this regexp?