Regular exression match not found
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 https://regexr.com/ and it is showing the match:
Am I missing something or is this a bug?
Many thanks for your support!
Vera
Comments
-
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 ?
2 -
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 regexr.com 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.
2 -
Hi Josh and Henry!
Great! I will go with the list-intersection many thanks for your answers!
Have a nice day!
1