From: Thomas Markus <t.markus@proventis.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Match 2 words and more
Date: Mon, 29 Nov 2021 07:23:10 +0100
Message-ID: <f0712672-3a2a-11bf-e94b-801ebfb2ccf0@proventis.net> (raw)
In-Reply-To: <CA+i5Jwbzej+34xLZvyVj1rM=SrXO1f+P4scaJUA2Y4xQfAJ0=A@mail.gmail.com>
References: <CA+i5Jwbzej+34xLZvyVj1rM=SrXO1f+P4scaJUA2Y4xQfAJ0=A@mail.gmail.com>
Am 28.11.21 um 01:27 schrieb Shaozhong SHI:
> this is supposed to find those to have 2 words and more.
>
> select name FROM a_table where "STREET_NAME" ~ '^[[:alpha:]+
> ]+[:alpha:]+$';
>
> But, it finds only one word as well.
>
> It appears that regex is not robust.
>
> Can anyone shed light on this?
>
> Regards,
>
> David
Hi,
It's robust, but syntax is sometimes weired
for words I would use something like (contains numbers too)
"STREET_NAME" ~ '(\w+\s+)+\w+';
or alpha only
"STREET_NAME" ~ '([[:alpha:]]+\s+)+[[:alpha:]]+'
regards
Thomas
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: t.markus@proventis.net
Subject: Re: Match 2 words and more
In-Reply-To: <f0712672-3a2a-11bf-e94b-801ebfb2ccf0@proventis.net>
References: <CA+i5Jwbzej+34xLZvyVj1rM=SrXO1f+P4scaJUA2Y4xQfAJ0=A@mail.gmail.com> <f0712672-3a2a-11bf-e94b-801ebfb2ccf0@proventis.net>
* 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