Regular expression \d metacharacters (equivalent to "[^0-9]") detailed

Source: Internet
Author: User
\d Metacharacters can match non-numeric characters, equivalent to "[^0-9]". This article mainly introduces the regular expression \d meta-characters of the relevant information, the need for friends can refer to, hope to help everyone.

\d Metacharacters can match non-numeric characters, equivalent to "[^0-9]".

Syntax structure:

(1). Constructor method:

New RegExp ("\\d")

(2). Object Direct Volume:

/\d/

Browser support:

(1). This method is supported by IE browser.

(2). Firefox supports this method.

(3). Google Chrome supports this method.

(4). Opera browser supports this method.

(5). Safria Browser supports this method.

Instance code:


var str= "I love Antzone \ n and you"; var reg=new RegExp ("\\d", "G"); Console.log (Str.match (reg));

The above code can match all characters except the number.


var str= "I love Antzone \ n and you"; var reg=/\d/g;console.log (Str.match (reg));

This code works the same as the code above.

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.