dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Regex for filtering badwords

  1. #1
    Join Date
    Dec 2013
    Posts
    5

    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.

  2. #2
    Join Date
    Dec 2013
    Posts
    5
    I found mistake in code: should be:
    \bv?ojet.?\b

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles