Regex compare two numbers
3 answers
The problem is that you are trying to turn two problems into one.
Regex does a great job of syntax (i.e. recognizes numbers), but garbage in semantics (i.e. recognizes meaning). So a regex will definitely help you recognize x-y
, but you are asking too much to get into reasoning about the relationship between x
and y
.
How often cited;
Some people, when faced with a problem, think, "I know, I will use regular expressions." They now have two problems. ( JWZ )
Or rather, you now have three.
+2
source to share