Thread: Regex examples
View Single Post
Old 04-04-2012, 03:04 AM   #29
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
I have a problem where hopefully a RegEx can help me. I want to find all words ending with f, with the exception of a few words. So, I want a hit on for example 'dwarf', but not on 'of' or 'behalf'.

The first part I can cover with \b\w+\b, but can I filter the results with an kind of exception list? I can't seem to find that.

*update* I seem to have found it, but I need to test further. This seems to do what I want:
\b(?!of|behalf)\w+f\b

Last edited by Toxaris; 04-04-2012 at 03:16 AM.
Toxaris is offline   Reply With Quote