• Regualar Expressions , my headache

    By Aleix Solà 2 decades ago

    Hello, I'm trying to implement this wonderfull tools that is kspam, but i'm crazy with regular expressions, can you help me in a regular expression that macthes ALL this words: corporate , logo , order . I tried various options but it doesn't match never. My last option is:


    REGEX#:[.corporate[.logo[.order]]]



    On the other hand, can you publish ten different examples about usefull REGEX??



    Thanks.

    • Re: regex

      By Tom Lyne 2 decades ago

      This will work:


      REGEX#:corporate|logo|order



      remember it's a : [colon] after #REGEX#



      -tom

      • By Aleix Solà 2 decades ago

        Sorry, but my goal is to mark this message that contains ALL these three words (corporate,logo,order):



        ….A GOOD CATCHY LOGO, STYLISH STATIONERY and OUTSTANDING WEBSlTE

        wilI make the task much easier.



        And then "your corporate" will order this….





        Can you sayme how is the REGEX that matches it?

        • Re:

          By Tom Lyne 2 decades ago

          You could try this:


           .{*}corporate.{*}logo.{*}order<br/>
          



          the . [period] matches any character except a newline. If you only want to match spaces and the characters a-z you could write:


           [a-z]{*}corporate[a-z]{*}logo[a-z]{*}order<br/>
          



          rather than write [a-z]{*} it's better to indicate a maximum possible number of characters, i.e.


           [a-z]{1-20}corporate[a-z]{1-30}logo[a-z]{1-10}order<br/>
          



          -tom

          • correction

            By Tom Lyne 2 decades ago

            If you want to match a-z and a space the class should be:


             [ a-z]<br/>
            



            -tom