Re: Regex for Word space Word space Word ....

From: <tomas(at)tuxteam(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Regex for Word space Word space Word ....
Date: 2021-11-23 13:53:58
Message-ID: YZzydgLNjRiEXmkX@tuxteam.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 23, 2021 at 09:58:00AM +0000, Shaozhong SHI wrote:
> Is there any regex for Word space Word space Word and more?

It isn't very clear what you want to achieve. From the other mails in
this thread I understand that your words start with an uppercase char
and continue with lowercase chars. Is that right?

You want exactly one space between words, or more than one?

What is this "...and more"? Arbitrary repetitions?

Which kind of regular expressions do you want to use? POSIX?

If all the answers to the above are "yes", you might try something like

"(?:[[:upper:]][[:lower:]]*[[:space:]]+)*[[:upper:]][[:lower:]]*"

(Caveat: untested). This would match a single word or more than one
word, separated by one or more spaces, where a word starts with one
upper-case character and continues with zero or more lowercases.

HTH
- t

In response to

Browse pgsql-general by date

  From Date Subject
Next Message tomas 2021-11-23 14:20:57 Re: PQexecParams, placeholders and variable lists of params
Previous Message Дмитрий Иванов 2021-11-23 13:39:27 Re: PQexecParams, placeholders and variable lists of params