pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christophe Pettus <xof@thebuild.com>
To: Shaozhong SHI <shishaozhong@gmail.com>
Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>
Subject: Re: How best to work around the issue - regex string cannot contain brackets
Date: Thu, 3 Feb 2022 08:58:45 -0800
Message-ID: <7AF5777D-148E-4534-B442-891A911B0D2B@thebuild.com> (raw)
In-Reply-To: <CA+i5JwYi246WtbtgQQy5o7vhsj8DLqunAA4FW1m68NpLUp0gLg@mail.gmail.com>
References: <CA+i5JwYi246WtbtgQQy5o7vhsj8DLqunAA4FW1m68NpLUp0gLg@mail.gmail.com>



> On Feb 3, 2022, at 08:53, Shaozhong SHI <shishaozhong@gmail.com> wrote:
> 
> One would consider the following would work, but it did not because the brackets.
> select regexp_matches('Department for Transport (Parking)', 'Department for Transport (Parking)', 'g')
> 
> Can anyone enlighten me?

You escape the ()s with a backslash:

xof=# select regexp_matches('Department for Transport (Parking)', 'Department for Transport \(Parking\)', 'g');
             regexp_matches             
----------------------------------------
 {"Department for Transport (Parking)"}
(1 row)






view thread (8+ messages)  latest in thread

Message-ID: <7AF5777D-148E-4534-B442-891A911B0D2B@thebuild.com>
Permalink:  ../7AF5777D-148E-4534-B442-891A911B0D2B@thebuild.com/
Also on:    postgresql.org/message-id/7AF5777D-148E-4534-B442-891A911B0D2B@thebuild.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: xof@thebuild.com, shishaozhong@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: How best to work around the issue - regex string cannot contain brackets
  In-Reply-To: <7AF5777D-148E-4534-B442-891A911B0D2B@thebuild.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox