Is Match Pattern Question - Need single digit between 1-9

Hello,

I am having an issue with my Is Match action. I would like it to check if the input is a single digit between 1-9.

I have tried the following in the Pattern section with no luck:
“[1-9]”
“1-9”
“d/[1-9]”

I left the default RegexOption choices (IgnoreCase, Compiled) I’m not sure what these do.

Thanks for your help!
Michelle

“[1-9]” works perfect for me.

Main.xaml (5.5 KB)

Try passing in 32 it will return as true.

[Edit] It seems to accept everything, I tried 8, 9, 10, 11, 12, 100 etc.

Hi @M_Jones92,

Try this pattern
Pattern :(?<!\S)\d(?![^\s?!])

Regards,
Arivu

@arivu96 This worked perfectly just had to remove the last ).

I used: “(?<!\S)\d(?![^\s?!])”

Thank you!

@arivu96 One more question for you because this has been driving me crazy all day and I really don’t understand regular expressions.

What pattern should I use in an is match action if I just want to check if its 30 or 31?

I tried “[30,31]” but it is accepting 40, 50, etc.

Thank you!

Hi @M_Jones92,

Pattern: (30|31)

For testing purpose you can use the below site to validate the expression.

https://regex101.com

Regards,
Arivu

1 Like

@arivu96 Thank you!!