The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Regex question: filtering a bunch of complete words

Discussion in 'General Discussion' started by silverbytes, Jun 1, 2006.

  1. silverbytes

    silverbytes Member

    Joined:
    May 31, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    I have many filters using body match regex using \\\\bspamword\\\\b the issue is that I won't create 1 filter for each word but I ignore the right syntax in regular expressions to put something like:


    Find the complete word spamword OR the complete word spamword2 OR spamword3

    I guess is very simple to combine all my filters into one

    Notice that I should enter \\\\b instead \b in order to work... don't ask me why, just another user gave out the trick.

    So can you help us all with this? is OR a symbol like ^ ?
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Regular expressions use the pipe character to represent boolean OR.

    The pipe character is: |

    For me with my UK keyboard, that's the key to the left of 'z' whilst pressing the shift key.
     
  3. silverbytes

    silverbytes Member

    Joined:
    May 31, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    So assuming I need to filter mortage and mortgage this should work:

    \\\\bmortage\\\\b|\\\\bmortgage\\\\b

    Ok let's go beyond: how do I filter variations of same word? Let's focus on sex, sex?, sexy, sexy!

    Is there a starting character and a wildcard I can use covering certain amount of characters?

    IE you want to filter sex, sexy, sexy? but no sextos (the last word is spanish but not related to sex)


    (starting character)sex(anyother 1character or 2 characters)

    Can you recommend a place to learn the syntax?
     
  4. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Search Google . . .
     
Loading...

Share This Page