IF Activity System.Text.RegularExpressions.Regex.isMatch

Hello,

I have a query for a file via the country code. If the country code is 3, 16 or 22, a different process takes place. In my query, it also recognises the country code 13 as True, presumably because it contains a 3. Can you give me a tip here?

Thank you in advance for your help.

Nina

Could you explain your problem with this a little more, please?
Because I don’t understand what your problem is, what is the output/outcome and what would you want to happen instead?

Mahrie :bear:

check if it is working following pattern
(\b3\b|\b16\b|\b22\b)

in case of it is not working, then plwase share some sample text with us. So we can check for options for another pattern strategy

Hi

Your expression is absolutely right
Just a small change is required

Mention like this in the expression part your Regex code

(^3|16|20)

Cheers @nina.wenner

Hi,

Can you share content of your string variable?
If there is no character except number, it might be better to use Array.Contains method than regex as the following because of maintainability.

Set codes to array variable in advance,

countryCodeArray = {"3","16","22"}

Then, condition is

countryCodeArray.Contains(yourString.Trim)

Regards,

Hi,

Thank you very much for tip. Now it recognises that 13 is not equal to 3, but with 32 or 33, for example, it gives me = 3.

do you have any ideas for this?

Thank you in advance.
Nina

It should be "^(3|16|20)$".
BTW, @ppr 's pattern will also work, i think.

Regards,

Hi Yoichi,

thank you very much! it works!!!

Best regards
Nina

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.