LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  pattern matching

    Employee
    Posted 12-11-2014 08:13

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    Hi there,

    I'm trying to evaluate some post codes in a if statement but it is not behaving as I would expect...

    I have a bunch of post codes in formats starting like RH10, R50, EG3

    my if statement is like this:

    if(regexIsMatchI(Postcode,"\\w\\w\\d\\d") or regexIsMatchI(Postcode,"\\w\\w\\d") or regexIsMatchI(Postcode,"\\w\\d\\d")) then
    {
    do something
    }

    on the most part, codes that follow this format work fine and run the true part of the if statement, however, I'm getting some postcodes with only numbers running the true part of the code as well? as an example I have a post code 1111 and I want it to run the false part of the if statement as it does not meet the criteria in the if statement. I tried playing around with \\d\\d\\d\\d and other variations just to see if I can get these outlier postcodes to evaluate correctly but am struggling...

    any ideas? is there s listing somewhere or all the various pattern wildcards? ie. I'm assuming in my example \\w\\w\\d equates to letter followed by letter followed by number.... or at least that is how it seems to be working... are there other options that can be used with regexIsMatch? there is no information anywhere in help or forums about this.

    thanks

    douglas


  • 2.  RE: pattern matching

    Employee
    Posted 12-11-2014 09:17

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: prashanth

    Just an idea you could probably expand on:

    If you use
    if regexIsMatchI(Postcode, "[A-Z][A-Z][0-9][0-9]") or regexIsMatchI(Postcode, "[A-Z][0-9][0-9]") then
    do something
    else
    do something else

    it seems to work better...


  • 3.  RE: pattern matching

    Employee
    Posted 12-11-2014 10:06

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    From what I remember, our pattern matching is based on PCRE. You can check the documentation on http://pcre.org/