Usermin filter rules and regex

  • Stephan Einhorn

    Stephan Einhorn - 2010-10-21

    Can anyone explain how to create a complex filter rule with regex ?
    A example with from and title clause will help me…


  • gandolf

    gandolf - 2011-01-27

    heres the deal with regex…. i will offer a brief… the objective is to construct a "codeline" that will MATCH what you wish to see.
    here is simple example  //i    the / is just identifier for start of codeline. the following / is end of codeline (except for the following codeline 'by the way' - here is an "i" which stands for "case insensitive". the codeline itself has . these brackets indicate that each character of the tested string  should match any of a-z or 0-9 or @ or ?.   now the ^ sign means "not". so to paraphrase "does any character of the tested string not match a-z or 0-9 or @ or ? or A-Z "…  so lets say you will accept any string that contains only a-z A-Z 0-9 @ ?….. anything else would then be a "hit" because the ^  is saying NOT a-z A-Z 0-9 @ ?…

    thus if a string to be tested has a # in it, then "hit" and your match for a "unwanted character" is TRUE.

    now as soon as regex finds a TRUE, it stops and runs what you have set for the match.

    most times you will test for more complex patterns. like email, phone number, etc. simple stuff.
    here is an // meaning "any of space questionmark, apostrophe, quote, semicolon, leftangle, rightangle….
    but without the ^  the paraphrase is…. "find the first of any of those characters"
    and with the ^ as in // paraphrase is …. "stop when you find a character that is neither of any of space or questionmark or apostrophe or quote or semicolon or leftangle or rightangle.
    plenty of stuff about the internet on it. keyword = preg_match. used in perl, php and .htaccess
    real necessary for security check on input
    ! just be sure that you can PARAPHRASE your statement real well. remember, the ^ is a very important feature so be sure that you understand that using a double-negative to find TRUE is kind of confusing but very necessary.

  • Anonymous - 2011-01-27

    I forget this post…

    Thanks for the help…
    My solution was to directly create a .procmailrc in my home directory,

    * To: shop@xxxxx
    * Subject: xxxxxx : fichier publi.

    And so… it works fine since 3 mounth…


Log in to post a comment.