Ask Question
24 December, 09:15

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

+5
Answers (1)
  1. 24 December, 09:23
    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?
Find an answer to your question 👍 “What is a regular expression that would match any digit 1-999? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers