IF contains any number

Hi All,

I would like to ask how can I do a if statement whether if the variable created to read a config contains any number?


1 Like

HI @jasperlzx,

you can use Is Match activity to check the string contains any number or not.

Pattern-> [0-9]


the number will be 8 digit. Will this work?


if its always 8 digits you can try
[0-9]{8} or \d{8}
if its varying size,
[0-9]+ or \d+
If you know size can vary from one limit to other, e.g., 2 to 5
[0-9]{2,5} or \d{2,5}

1 Like

@jasperlzx Check attached file i think its useful

CheckNum.zip (1.8 KB)

1 Like

Hi @jasperlzx,

if its contain any single number it will return true value.

if you want to check exactly 8 digit number present means use below pattern.
Pattern-> [0-9]{8}


check a variable contains any digits other than zero in uipath?