Imperva Cyber Community

communities_1.jpg
 View Only
  • 1.  Define regular expression.

    Posted 11-24-2023 10:06
    Edited by Jose Yero 11-24-2023 10:06

    Hello community.

    I'm getting into the knowledge of understanding regular expressions.

    MY question is, could you help me how to define a regular expression that always detects the number 035 that comes at the beginning within a 15-digit value.

    035 ##############


    #On-PremisesWAF(formerlySecuresphere)




  • 2.  RE: Define regular expression.

    Posted 11-24-2023 15:17
    Edited by John Thompson 11-24-2023 15:26

    Hi Jose.  Great question.  I don't happen to know the answer off the top of my head, but anytime I've had to develop RegEx's for DLP or data discovery and classification, advanced profiling filters, or routing / delivery rules, etc., I've turned to a couple of tools / sites.  You may have already looked at these but, I've used them in the past and found them helpful:

    I know you can google any other number of regex tools and library's and find a ton of them, but several of us have used those three tools and found them helpful.

    -



    ------------------------------
    John Thompson
    Presales Director
    Imperva
    San Diego CA
    ------------------------------



  • 3.  RE: Define regular expression.

    Posted 11-27-2023 09:55

    Hi Jose,

    This will match assuming the 15 digit value is also comprised of numbers.

    ^035\s[0-9]{15}$

    This regex can be tested at: https://regex101.com/r/SJogss/1



    ------------------------------
    Jaired Anderson
    Imperva
    ------------------------------