Re: Match 2 words and more

From: Thomas Markus <t(dot)markus(at)proventis(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Match 2 words and more
Date: 2021-11-29 06:23:10
Message-ID: f0712672-3a2a-11bf-e94b-801ebfb2ccf0@proventis.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wicher 2021-11-29 09:23:15 DDL tools for working with views in dependency order?
Previous Message Gavin Flower 2021-11-28 21:23:23 Re: [EXTERNAL] Re: Inserts and bad performance