1

I have tried various other Stackoverflow examples and cannot get it to work. I need an input mask that validates the input is from 0 to 254.

MY CURRENT ATTEMPT:
This is from the example & fails utterly...

dictionary.elements.txtGlobalAddress.inputmask('Regex', { regex: "^[0-9][0-9][0-9]?$|^254$" });

enter image description here

Prisoner ZERO
  • 13,848
  • 21
  • 92
  • 137

1 Answers1

2

Here's a regex that will match a whole number from 0 to 254.

^([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-4])$

You can test it here:

Regex test

Remember that regular expresions deals with text and trying to match a number range could be hard if you don't understand them. Here's more info about it so you can learn how the regex above works.

Gerardo
  • 979
  • 1
  • 7
  • 15