A regular expression matches a number, one or more __ regular expressions of a slash

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.