Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use regular expression\ D metacharacters

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the regular expression\ D metacharacter how to use, the article introduces in great detail, has a certain reference value, interested friends must read it!

\ D metacharacters can match non-numeric characters, which is equivalent to "[^ 0-9]".

Grammatical structure:

(1)。 Constructor mode:

New RegExp ("\\ D")

(2)。 Object direct quantity method:

/\ D/

Browsers support:

(1). Ie browser supports this method.

(2)。 Firefox browser supports this method.

(3)。 Google browser supports this method.

(4) the opera browser supports this method.

(5) the .safria browser supports this method.

Example code:

Var str= "I love antzone\ n and you 360"; var reg=new RegExp ("\\ D", "g"); console.log (str.match (reg))

The above code matches all characters except numbers.

Var str= "I love antzone\ n and you 360"; var reg=/\ D hand Gram console.log (str.match (reg))

The function of this code is the same as the above code.

The above is all the contents of the article "how to use regular expressions\ D metacharacters". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report