Hi,
I am trying to create a regex match that detects if illegal characters in a string.
Currently I have “[1]+$” but I would like to add - and ’ as characters to be allowed into it.
Thanks for your help.
-
A-Za-z0-9 ↩︎
Hi,
I am trying to create a regex match that detects if illegal characters in a string.
Currently I have “[1]+$” but I would like to add - and ’ as characters to be allowed into it.
Thanks for your help.
A-Za-z0-9 ↩︎
Hi,
We cannot see the above pattern properly due to it’s this forum’s meta character.
For now, Can you try as the following?
System.Text.RegularExpressions.Regex.IsMatch(yourString,"[-'+$]")
If the above doesn’t work for you, please share your current pattern as image or preformated text ( using the above </>
menu)
Regards,
Hi @LeThomp
Further to @Yoichi’s post, if you don’t know all the illegal characters you can validate your text by inserting the ‘allowed’ characters.
Like this:
System.Text.RegularExpressions.Regex.IsMatch(yourString,“[^a-zA-Z0-9 ]”)
This will match on anything that is not a:
Hopefully this helps you.
Cheers
Steve
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.