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?
Rega
On 2021-11-28 00:27:34 +, Shaozhong SHI wrote:
> It appears that regex is not robust.
It does reliably what you tell it to do.
I would agree that after almost 50 years of extending it, the syntax has
become a bit of a mess.
hp
--
_ | Peter J. Holzer| Story must make more se
On 2021-11-28 00:27:34 +, Shaozhong SHI wrote:
> this is supposed to find those to have 2 words and more.
>
> select name FROM a_table where "STREET_NAME" ~ '^[[:alpha:]+ ]+[:alpha:]+$';
I think you meant
select name FROM a_table where "STREET_NAME" ~ '^[[:alpha:]+ ]+[[:alpha:]]+$';
Note
On 11/27/21 6:49 PM, Alvaro Herrera wrote:
On 2021-Nov-28, Shaozhong SHI wrote:
[snip]
It appears that regex is not robust.
This was my attitude when I first started to learn computer programming. /My
code is perfect, i//t can't be my fault!! There must be a compiler bug!!!/
Nah.
Just i
On Sat, Nov 27, 2021 at 5:27 PM Shaozhong SHI
wrote:
> 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
On Nov 27, 2021, at 16:27 , Shaozhong SHI wrote:
>
> select name FROM a_table where "STREET_NAME" ~ '^[[:alpha:]+ ]+[:alpha:]+$’;
The simplest thing that does what you says is I think:
select name FROM a_table where "STREET_NAME" ~
‘^([[:alpha:]]+\s)+[[:alpha:]]+$’;
On 2021-Nov-28, Shaozhong SHI wrote:
> 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.
How about something like this?
'^([[:<:]][[:alpha:]]+[[:>:]]( |$)){2}$'
You
> On Nov 27, 2021, at 5:27 PM, Shaozhong SHI wrote:
>
>
> 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 an