Thread: Regex examples
View Single Post
Old 03-02-2014, 07:36 PM   #303
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by gipsy View Post
There is an way to ignore some of the regex results
Yes, but this requires some serious "Regex Fu" (e.g. negative lookbehinds).

I'd simply search for repeated Greek words with a hyphen between them and replace the hyphens with a substitute character (@):

Find:(\p{Greek}+)-(\1)
Replace:\1@\2

Then you can use your regex and at the end you can globally replace all at signs (@) with hyphens.

@Jellby: Can you optimize this simple regex by creating a regex that will find a Greek word not followed by a hyphen and the same Greek word using backreferences and negative lookbehinds?
Doitsu is offline   Reply With Quote