Announcement

Collapse
No announcement yet.

Formula using regex to identify letter in phone number not working correctly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Formula using regex to identify letter in phone number not working correctly

    Hello everyone,

    I am trying to get a formula to work in the Formula field in the Entity Manager, that should output a 1 or 0, depending on whether or not there is a letter in the phone number field.

    This is the formula I'm trying to use:

    Code:
    ifThenElse(string\test(phoneNumber, '.*[a-zA-Z].*'), leadContainsPhoneNumber=0, leadContainsPhoneNumber=1);
    The field 'phoneNumber' is of the type 'Phone' and typically includes number strings, but sometimes also letters or a phrase like 'not provided'.
    A second field, 'leadContainsPhoneNumber', which is a Boolean (checkbox that should be checked if output is 'TRUE' (or 0) and unchecked if output is 'FALSE' (or 1).
    The expression should check if the string in the field phoneNumber contains any letter from a-z (or lower or uppercase). However, for some reason, the box in the records is always checked, even if letters are present. I cannot figure out if something in the syntax is incorrect, or if I am overlooking something relevant here.

    Does anybody have an idea what might be wrong, or how to solve it?

  • #2
    My regex is basically search copy on the internet.

    My personally suggestion for you to make this work is to start simply with your formula. Why don't you start out with a "check for number 5" first? For example:

    string\test(phoneNumber, '5')

    And test to see if it work, then go from there then slowly doing a simple letter, like 'a'. If it doesn't work then it too early to worry about 'a-zA-Z'

    Comment

    Working...
    X