Regex not working in calculation field

Comments

2 comments

  • Automations Bot

    Hey Russell,

    Instead of returning match1[0] directly, when Podio injects your code with sample field value, the error occurs because when regex is executed nothing found returns null and you're trying to directly access an array which might not be returned, in this case your sample test value that Podio injects when validating a calc field.

     

    so instead of using this match1[0] use this:

    return match1 && match1.length>0 ? match1[0] : "not found";
     
    this will ensure that if match1 exists and is an array with length greater than 0, if it is then it's going to return the first match else it'll return not found
     
    Note: Also please make sure you use mapValue.toString() to convert it to a valid string if not already
    Let me know how that goes!
    0
    Comment actions Permalink
  • Rainer Grabowski

    HI Russel,

    can you please provide an example text of an address and explain what you want to match? 

    Rainer

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk