Regex for properly formed names
Regex for properly formed names
От:
Shaozhong SHI <shishaozhong@gmail.com>
Дата:
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
Aw: Regex for properly formed names
От:
Karsten Hilbert <Karsten.Hilbert@gmx.net>
Дата:
> How to write a regex to detect wrongly formed names? step one: define (not describe) a properly formed name Best, Karsten
Re: Regex for properly formed names
От:
Metin Ulusinan <metin.ulusinan@ssicilian.net>
Дата:
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@gmail.com> wrote:
Hello,What is the regex for properly formed names?Scenario,Bus Stop (St Peter's Church)Scenario - wrongly formed nameBus stop (st peter's church)How to write a regex to detect wrongly formed names?Regards,David
Re: Regex for properly formed names
От:
Steve Midgley <science@misuse.org>
Дата:
On Mon, Oct 11, 2021, 6:15 AM Metin Ulusinan <metin.ulusinan@ssicilian.net> wrote:
If regex is not necessary;INITCAP(bus_stop_name) != bus_stop_namecan be answer? 😎On Mon, Oct 11, 2021 at 4:01 PM Shaozhong SHI <shishaozhong@gmail.com> wrote:Hello,What is the regex for properly formed names?Scenario,Bus Stop (St Peter's Church)Scenario - wrongly formed nameBus 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
Re: Regex for properly formed names
От:
Erik Brandsberg <erik@heimdalldata.com>
Дата:
Pointing back to Karsen's comment, what IS the definition, and instead of asking "what is the regex" bring the question to a higher level, such as "How can I validate that an insert on a "name" field has all the words capitalized (but just the first word). From a formal name perspective however, a name doesn't have all words capitalized, like "of" and "and" would be lower case. It may be easier to implement different logic than a regex to do this.
On Mon, Oct 11, 2021 at 9:01 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
Hello,What is the regex for properly formed names?Scenario,Bus Stop (St Peter's Church)Scenario - wrongly formed nameBus stop (st peter's church)How to write a regex to detect wrongly formed names?Regards,David
Erik Brandsberg
+1 (866) 433-2824 x 700