Ask Question
3 May, 17:41

What is a regular expression that would match any digit 1-999?

+4
Answers (1)
  1. 3 May, 18:41
    0
    [1-9][0-9]{0,2}

    Explanation:

    The numbers to be matched consist of three digits with the following requirements:

    - Digit 1 can take the values 1-9

    - Digit 2 can take the values 0-9

    - Digit 3 can take the values 0-9

    - Digits 2 and 3 are optional, that is the number may consist of 1,2 or 3 digits in all.

    Taking these into account, the overall regular expression can be represented as follows:

    [1-9][0-9]{0,2}
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is a regular expression that would match any digit 1-999? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers