locked
Regex pattern for specific digits RRS feed

  • Question

  • Hi,

    How do I write a regex pattern for numbers -1, 0, 1, 2, 3 4, 5?  I need for any combination of digits 0 to 5 and another solely for negative one.

    Appreciate any help.


    Marilyn Gambone

    Thursday, December 10, 2020 4:59 PM

Answers

  • Try this pattern:

       -1|[0-5]

    (Or “^(-1|[0-5])$” to match the whole string).

    • Marked as answer by deskcheck1 Friday, December 11, 2020 6:25 PM
    Friday, December 11, 2020 5:25 PM