Regular verification: the format in the input box must be "5 | 0.03", and the number in front of it must be up to 2 digits, and the number after "|" must be a decimal point and less than 1.

how to write the regular expression < del > ~ < / del > ~

Mar.28,2021

var reg = /^\d{1,2}\|0\.\d+$/ //,10

reg.test('5|0.03'); //true
reg.test('5|3'); //false
reg.test('5|1.3'); //false
reg.test('522|0.3'); //false

var reg = / ^ [1-9]\ d\ | 0\.\ code $

Menu