Hi Mates
Is there any experts on Reg-Ex to identify characters/string from textbox
In shortly: When users enter alphabets in textbox then identify to alert or set border RED color to understand them invalid
Example : valid cases are below
20:30
40;30
50.60
but not 20:30abc or abc20:30 or 20:abc
when user enter alphabets then it should alert.
If(IsMatch(TextInput2.Text,"^[?!A-Za-z]*$"),Red,Green)
as of using above code but, its not alerting when users enter characters in textbox in-between.
your help would be highly apricated.
@ben-thompson is correct that [a-z][A-Z] will get you any capital or lowercase letter in the latin alphabet, but it is also worth pointing out that the simpler regex pattern:
\p{L}
is also a shorthand for <any letter> and encompasses non-standard letter characters.
I would also point out that you can use the Contains operator to specify a match anywhere in the string without needing to make a more elaborate regex:
IsMatch( TextInput1.Text, "\p{L}", Contains )
The one thing I missed from the regex site is that the site automatically added a global flag which I missed.
[a-zA-Z]/g is what you should be using.
Really thanks for reply,
On top of that I just added *$ now its working if more than 0 characters fine, but now issue is how to find and validate in between letters
ex. if user enter 123abc then it should trigger but the given formula is not throwing between characters.
If(IsMatch(TextInput2.Text,"[a-zA-Z]*$"),Red,Green)
Help for if found any characters in whole text box ..?
My advice when it comes to regex is to always use a regex editor to create your Regular expression the first one that comes up on Google is https://regex101.com/ and it seems to work fine.
And don't forget that you can reverse true and false if it makes the query easier which I suspect is the case in your example.
[a-zA-Z] will return true if a letter is within the string and false if the format matches the correct format so
If(IsMatch(TextInput2.Text,"[a-zA-Z]/g"),Green,Red) or If(!IsMatch(TextInput2.Text,"[a-zA-Z]/g"),Red,Green) should work for you.
Edit added the global /g flag I didn't notice had been added by the regex site first time around.
WarrenBelz
94
Most Valuable Professional
Michael E. Gernaey
72
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1