pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: Shaozhong SHI <shishaozhong@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Detecting repeated phrase in a string
Date: Thu, 9 Dec 2021 16:11:31 +0100 (CET)
Message-ID: <VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena> (raw)
In-Reply-To: <CA+i5JwaEwK=ktV-H-xS2dHgGfWL0RPRDVhcghJ5rQM45DqLY-g@mail.gmail.com>
References: <CA+i5Jwbe9uH5dwSvV1Ur-zf7VXMCPNsNS20+sBQx4X1Ufr_ANQ@mail.gmail.com>
	<20211209133510.lkn6vjh5eqpi5csg@hjp.at>
	<CA+i5JwaEwK=ktV-H-xS2dHgGfWL0RPRDVhcghJ5rQM45DqLY-g@mail.gmail.com>


På torsdag 09. desember 2021 kl. 15:46:05, skrev Shaozhong SHI <
shishaozhong@gmail.com <mailto:shishaozhong@gmail.com>>: 


Hi, Peter, 

How to define word boundary as either by using 
^ , space, or $ 

So that the following can be done 

fox fox is a repeat 

foxfox is not a repeat but just one word. 

Do you want repeated phrase (list of words) ore repeated words? 
For repeated words (including unicode-chars) you can do: 

(\b\p{L}+\b)(?:\s+\1)+ 

I'm not quite sure how to translate this to PG, but in JAVA it works. 



-- 
Andreas Joseph Krogh 
CTO / Partner - Visena AS 
Mobile: +47 909 56 963 
andreas@visena.com <mailto:andreas@visena.com> 
www.visena.com <https://www.visena.com; 
 <https://www.visena.com; 

view thread (5+ messages)  latest in thread

Message-ID: <VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena>
Permalink:  ../VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andreas@visena.com, shishaozhong@gmail.com
  Subject: Re: Detecting repeated phrase in a string
  In-Reply-To: <VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena>
  References: <CA+i5Jwbe9uH5dwSvV1Ur-zf7VXMCPNsNS20+sBQx4X1Ufr_ANQ@mail.gmail.com> <20211209133510.lkn6vjh5eqpi5csg@hjp.at> <CA+i5JwaEwK=ktV-H-xS2dHgGfWL0RPRDVhcghJ5rQM45DqLY-g@mail.gmail.com> <VisenaEmail.50.2affbb94dee70e79.17d9fba1d20@tc7-visena>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox