Regular exression match not found

Vera OVera O Super Learner
edited March 6 in General discussion

Hi All!

I would like to create a Regular Expression match check for the whole number 3 in a string.

The regex would be: [^.][3]|^3[^.]

Although in the result you can see that it is not correct - the 4th line should be true as it contains 3 as a whole number.

I've tested the Regex at and it is showing the match:

Am I missing something or is this a bug?

Many thanks for your support!



  • Josh BoxerJosh Boxer Administrator
    edited March 6

    Hi Vera

    If the values are always singles or comma separated lists then you can use:

    Still thinking about your actual regex question...

    Is it possible the numbers could be 34 or 43 or always < 10 ?

  • Henry SimmsHenry Simms Experian Super Contributor

    I think the regex isn't working because the Data Studio function is evaluating the comma-separated list as a single value ("4.3,4,3,2.3") while is evaluating them as separate value against the expression. Neither is wrong, just different ways of applying the regex.

    If you wanted to use regex, you'd need to take account of possible commas, but I think Josh's list intersection solution, which uses the List Transformation functions that do see a CSV list as comprising multiple values, is very neat and probably the way to go here.

  • Vera OVera O Super Learner

    Hi Josh and Henry!

    Great! I will go with the list-intersection many thanks for your answers!

    Have a nice day!

Sign In or Register to comment.