RegExp to match fraction
- by user3627265
I'm trying to perform regex to match a fraction.
The user will input a fraction eg., 1/4, 1 1/2 10/2 so on.
I have tested this regex and it works, but the problem is when I type in 10, 20, 30, 40 so on It does not recognized these values. This is my regex As you can see, it first sorted out the integer and then the slash and lastly the integer after the slash.
var check_zero_value = str1.match(/[1-9]\/[1-9]/g);
if(!check_zero_value1)
{
return false;
}
Any idea on this?