Q: Regex for number range with lowest and highest bound EXTjs i would like to validate if the entered value is a number range and check if the first digit is lower than the second digit in EXTjs
i use this regex: /\d+-\d+?$/ but i dont know to check if the first digit is lower than the second one.

A: This is not the way you should do it! But I wanted to take my mind for a little stroll, so I started thinking of ways to do it, and to illustrate the stupidity of doing it with regex.
This way will do it for you with a maximum of two digit numbers in the first number:
^(\d-[1-9]\d+|1\d-[2-9]\d+|2\d-[3-9]\d+|3\d-[4-9]\d+|4\d-[5-9]\d+|5\d-[6-9]\d+|6\d-[7-9]\d+|7\d-[8-9]\d+|8\d-9\d+|0-\d|1-[2-9]|2-[3-9]|3-[4-9]|4-[5-9]|5-[6-9]|6-[7-9]|7-[8-9]|8-9|\d0-\d\d|\d1-\d[2-9]|\d2-\d[3-9]|\d3-\d[4-9]|\d4-\d[5-9]|\d5-\d[6-9]|\d6-\d[7-9]|\d7-\d[8-9]|\d8-\d9)$

See it here at regex101.
You' starting to see why it isn't the way to go?
Anyway, it's done in three parts:


*

*Test the left tens digit against a higher tens digit (or more) on the right

*Test single digits (left being lower than right)

*If both have the same tens digit, test the ones digits against each other


Note! It's hand written and not very tested so it may contain errors and could probably be optimized further.
With single digits it's feasible though:
^(0-\d|1-[2-9]|2-[3-9]|3-[4-9]|4-[5-9]|5-[6-9]|6-[7-9]|7-[8-9]|8-9)$

but the more digits, the more ridiculous.
