In: Computer Science
Write a regular expression that can represent any digit, without more than one digit or non digit characters.
I am hoping that you are aware about regular expressions, hence not discussing the basics of it. Directly I am jumping to answer your question.
A regular expression that can represent any digit:
[0-9]?\d+
A regular expression that can represent non digit characters. That means it will find only characters not the digits/numbers including spaces.
\D
Didnt got what are you asking with this statement. A regular expression that can represent without more than one digit. Please explain this so that I can answer.
If you are asking like to have single occurence of a digit then below expression can help.