Service Catelog - Text Box
Dear All,
I want to restrict a text box to only allow text and numbers. Can you help me with the .net regular expression for this?
Thanks
Daniel
Best Answer
-
Peter_Miklian Customer Advanced IT Monkey ✭✭✭
Something like this one?
^[\w]*$
^ asserts position at start of a line
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\w matches any word character (equal to [a-zA-Z0-9_])
$ asserts position at the end of a line
Play with regexes and learn by browsing/searching in explanations in the Quick reference at https://regex101.com/
5
Answers
Something like this one?
^ asserts position at start of a line
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
\w matches any word character (equal to [a-zA-Z0-9_])
$ asserts position at the end of a line
Play with regexes and learn by browsing/searching in explanations in the Quick reference at https://regex101.com/
Thank you for the help.
Its appreciated.
Kind Regards
Daniel