Re: Regular Expression For Duplicate Words

From: Jian He <hejian(dot)mark(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Shaozhong SHI <shishaozhong(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Regular Expression For Duplicate Words
Date: 2022-02-02 18:21:33
Message-ID: CAMV54g1x=PDL4QPfp_BmBd93KtFfndG-SmK+hhvdQd-PW=VtaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It's an interesting question. But I also don't know how to do it in
PostgreSQL.
But I figured out alternative solutions.

GNU Grep: grep -E '(hello)[[:blank:]]+\1' <<<'one hello hello world'
ripgrep: rg '(hello)[[:blank:]]+\1' --pcre2 <<<'one hello hello world'

On Wed, Feb 2, 2022 at 8:53 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Wed, Feb 2, 2022 at 1:00 AM Shaozhong SHI <shishaozhong(at)gmail(dot)com>
> wrote:
>
>> This link is interesting.
>>
>> regex - Regular Expression For Duplicate Words - Stack Overflow
>> <https://stackoverflow.com/questions/2823016/regular-expression-for-duplicate-words>
>>
>> Is there any example in Postgres?
>>
>>
> Not that I'm immediately aware of, and I'm not going to search the
> internet for you.
>
> The regex capabilities in PostgreSQL are pretty full-featured so a
> solution should be possible. You should try translating the SO post
> concepts into PostgreSQL yourself and ask specific questions if you get
> stuck.
>
> David J.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2022-02-02 18:35:37 Re: pg_basebackup with hostssl ?
Previous Message Adrian Klaver 2022-02-02 17:20:12 Re: pg_basebackup with hostssl ?