When using match it, if no global flag (g) is set, the 0 elements of the array contain the entire match, and the 1th to n element package
Contains any substring matches that have occurred in the match. This is equivalent to an Exec method that does not have a global flag set. If you set the global
Flag, Element 0 to n contains all matches.
Match a slash with one or more slashes
var results=m.match (New RegExp ("///+", "GI"));
Match number one or more
var results=str.match (New RegExp ("//d+", "GI"));
var m = "10/12//2010/";
var s = "The rain in Spain falls mainly in the plain";
var re =/ain/ig;
var r = S.match (re);
Alert (R);
var ar = M.match ('//')
var str= "1 plus 2 equal 3";
var results=str.match (New RegExp ("//d+", "GI"));
var results=m.match (New RegExp ("///+", "GI"));
for (i = 0; i < results.length; i++) {
var rs = results[i];
Alert (RS); Output is '/', '//', '/' three
}
JS Validation amount Regular expression
var regexp=/^-?/d+/. {0,}/d{0,}$/;
var regexp=/^/d{1,6}/. {0,1}/d{0,2}$/;
var $number = parseint ($salay, 10); int type
var $number = parsefloat ($salay); Float type