Re: Regex for properly formed names

From: Steve Midgley <science(at)misuse(dot)org>
To: Metin Ulusinan <metin(dot)ulusinan(at)ssicilian(dot)net>
Cc: Shaozhong SHI <shishaozhong(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Regex for properly formed names
Date: 2021-10-11 15:08:45
Message-ID: CAJexoSJ7NuY2aJd2Hc+N3q2KEgPimu6hJwLD0-reRSAZks4xuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Oct 11, 2021, 6:15 AM Metin Ulusinan <metin(dot)ulusinan(at)ssicilian(dot)net>
wrote:

> If regex is not necessary;
>
> INITCAP(bus_stop_name) != bus_stop_name
>
> can be answer? 😎
>
>
>
> On Mon, Oct 11, 2021 at 4:01 PM Shaozhong SHI <shishaozhong(at)gmail(dot)com>
> wrote:
>
>> Hello,
>>
>> What is the regex for properly formed names?
>>
>> Scenario,
>>
>> Bus Stop (St Peter's Church)
>>
>> Scenario - wrongly formed name
>>
>> Bus stop (st peter's church)
>>
>> How to write a regex to detect wrongly formed names?
>>
>> Regards,
>>
>> David
>>
>
If the regex definition is a space followed by a lower case letter or a
lower case letter at the start of the string, I haven't tested this (on my
phone) but /(^[a-z])|(\s[a-z])/

Some regex flavors don't like | as 'or' so you'd want to figure that out..
I'm not sure about postgres.

Steve

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Erik Brandsberg 2021-10-11 15:16:29 Re: Regex for properly formed names
Previous Message Erik Brandsberg 2021-10-11 14:52:30 Re: LISTEN / NOTIFY