I want to validate a value from html form in JavaScript function, the format is a bit flexible.
i.e,
1 or 2 or 3 or 4 or 5 integer value followed by back slash(/) followed by 1 or 2 or 3 integers.
Example.
12345/123 is a valid value.
1234/12 is a valid value.
123/123 is a valid value.
1/1 is a valid value.
a/123 is NOT a valid value.
123/% in NOT a valid value.
You can try this regex:
^\d{1,5}\/\d{1,3}$Example:
That said, you should start from the basics:
http://en.wikipedia.org/wiki/Regular_expression
http://www.regular-expressions.info/
https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp
Here you can find many examples: http://regexlib.com/?AspxAutoDetectCookieSupport=1