RegExp to match fraction
Posted
by
user3627265
on Stack Overflow
See other posts from Stack Overflow
or by user3627265
Published on 2014-06-09T03:10:59Z
Indexed on
2014/06/09
3:25 UTC
Read the original article
Hit count: 82
regex
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?
© Stack Overflow or respective owner