Thread: Regex examples
View Single Post
Old 11-17-2015, 01:58 PM   #488
gipsy
Connoisseur
gipsy began at the beginning.
 
Posts: 81
Karma: 10
Join Date: Nov 2013
Device: Kobo Aura HD
Code:
#Fixes ώ in words that are misspelled
CorrectText("ώ fixes",r"(\w+)(ιίι|\(ό|ο\)|ίό|ο&gt;|ο'\)|ο'ι|ιό|οί|ιο|οι|&lt;ο|οϊ)(\w+)(?![^<>]*>)(?!.*<body[^>]*>)", IsFixO)
Hi,
in the epub tidy plugin i use this code to find mispelled ώ
It searches for ιίι, (ό, etc and if it's correct it change it to ώ.

As the code is now, its working only works within a word (for example στιίιμα changes to στρώμα

It doesn't work in the begining or the end of the word (for example ιίιστε [the correct word is ώστε] or αντιπαρατεθιίι [the correct word is αντιπαρατεθώ]

If i change the first (\w+) to (\w+|\ ) i get findings and in the beggining if the word.
What i can change to match and the end of the word?

Thanks

Last edited by gipsy; 11-18-2015 at 08:22 AM. Reason: Explanations
gipsy is offline   Reply With Quote