I have this expression:
([-][1-9]*[/][-][1-9]*|[1-9]*[/][1-9]*|[1-9]+\d*)
and my thought process around it was there was three cases.
When the rational number is in the form a/b:
[1-9]*[/][1-9]*
When the rational number is in the form -a/-b (turns out to be positive because both numerator and denominator are negative):
[-][1-9]*[/][-][1-9]*
When the rational number is an integer (because all integers are rational numbers):
[1-9]+\d*
Is there any way to make this regular expression shorter?
Especially where I have the two cases where its either a/b or -a/-b, is there any way to combine those two cases into one case?