Hi Mates
Is there any experts on Reg-Ex to identify characters/string from text box
In shortly: When users enter alphabets in text box 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 text box in-between.
your help would be highly appreciated.
Simon its working perfectly. Thank you very much you saved my time.
If(IsMatch(TextInput2.Text,"(-)?\d+[;:.,](-)?\d+" ),Green,Red)
๐
Hi @SimonPiquer
it seems like some what very close this issue
\d+ works fine
but as per update they also want to update negative values as well like
-20:20
-20,-5
etc..help me for allow negative values as well.
I guess you could do it this way if you really want to lock it down:
If(IsMatch(TextInput2.Text,"\d{2}[;:.,]\d{2}" ),Green,Red)
This changes it so that it matches text of the following format:
\d{2} = 2 numeric digits
[;:.,] = any of the characters within the brackets
\d{2} = 2 numeric digits
If you don't want to limit it to two digits before/after the symbol you can replace \d{2} with \d+
Notice also I made Green the result for a true match here.
Hi @SimonPiquer
Thanks for explanation,
actually i have two validations that is
1. Character validation : This is done.
If(IsMatch(TextInput2.Text,Match.Letter,MatchOptions.Contains),Red,Blue)
2.Special character validation. It should allow only (Dot,Comma,SemiColon, Colon) only in-between data like(40.50 or 40:50, or 40,50) but not all special characters.
My Formula below for to alert if user enter special characters
If(Or(
Find("*",TextInput1.Text)>0,
Find("&",TextInput1.Text)>0,
EndsWith(TextInput1.Text,"*")=true,
EndsWith(TextInput1.Text,"&")=true),Red,Blue)
I am sure this hard coding is not right way to but, don`t know how to alert on special characters here
Here i am hard coding with each and every special character actually.
Condition on special character is
Not Allowed Special Character Symbols =(!`~@#$%^&*()_+")
Allowed= (Dot, SemiColon, Colon,Comma)
consecutive not allowed : **,%%,&&,((,))== etc
Is there any code for Special characters as well ..?
Kindly validate second condition validation as well.
Hi, Glad that it works!
Documentation for IsMatch can be found here.
To break it down:
If(IsMatch(TextInput2.Text,Match.Letter,MatchOptions.Contains),Red,Green)
Match.Letter means that it matches if there is a letter found, if you changed it to Match.Digit it would instead match if numbers were entered, you can also combine multiple criteria with an '&' to create a pattern to match.
MatchOptions.Contains means that it checks if the entered text contains the defined pattern. This can be exchanged with for example 'BeginsWith' or 'EndsWith' to make it check specific parts of the entered text. If you don't puta a MatchOptions in your formula it will check if the entire text matches your input text.
If it worked then mark as a solution as well.
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Hi @eka24
Really great, your solution also working but i just tested with Simon reply earlier and closed.
Hi @SimonPiquer
Great man its working as expected...
Hi @SimonPiquer ,
Really thanks for reply.
Can you please elaborate a little bit more, because it seems little background work is there on Match.Letter and
Match Options.Contains
do i need to add/ create variable any ...? other wise how match.letter will capture only characters ..?
please explain more what needs to be add any variable if required in which property.
If(IsMatch(TextInput2.Text,Match.Letter,MatchOptions.Contains),Red,Green)
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,083
Most Valuable Professional