Thread: Regex examples
View Single Post
Old 04-16-2014, 11:32 AM   #325
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Doitsu View Post
The following very simple regex will find one occurrence of "tov" at the beginning, at the end and in the middle of a string of text enclosed by <i></i> tags:

Find:<i>(.*?)τον(.*?)</i>
Replace:<i>\1του\2</i>
But it would also find it between two <i></i> blocks, wouldn't it?

<i>foo</i> τον <i>bar</i>

Even with non-greedy modifier, the asterisk matches as many as needed to make the whole pattern match.
Jellby is offline   Reply With Quote