If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Regex for filtering badwords

Hello, I have a filter for filtering badwords in my native language. My language is very accurate not like simple English, so it is harder to give good exaple in English. I don't find good word / verb to have good example. But I will try.

I separated the pattern for three parts: prefix, middle and suffix. The middle will not change. The suffix can change. The prefix can be a specific letter or may not be present.

lets give example now:

Let's have the middle part: mil.

I want to find words like smile, smiles, smiling or mile, miles, miling

but not words like mill, mills, milling or words with different prefix like s. Here I dont find realistic example. So if there would be words like emile, emiles, emiling, amile, amiles, amiling, and so on. These words have not to be included in the result.

In my native language I tried something similar:

\bv?ojet.?\bal

where ojet is the middle part and v is the only possible prefix. But this this not find anything.

My second try was

[v^d]?ojed[ueo][usm]

this time with different middle word: ojed. The suffix is changing here according declination. But always this does not work.

The common problem in my tests were that some of the characters of the incorrect middle word were captured. And I need only to capture the character of the correct word, in English example it is the mil, or smile, or smil... etc. So how can I specify pattern, that will capture as many characters as possible from the correct word, but not to capture the characters which are not presend.

Note:

I work only with a-z (small characters) no white characters in the text.