In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
I would like to share with you how to use the regular expression\ d metacharacters. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it!
Regular expression\ d metacharacter:
\ d metacharacters can match numeric characters, which is equivalent to "[0-9]".
Grammatical structure:
Constructor mode:
New RegExp (\\ d)
Object direct quantity method:
/\ d /
Browsers support:
IE browsers support this metacharacter.
Firefox browser supports this metacharacter.
Google browser supports this metacharacter.
Example code:
Example 1:
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 the numbers in the string.
Example 2:
Var str= "I love antzone\ n and you 360"; var reg=/\ ddebase g; console.log (str.match (reg))
The function of this code is the same as the above code.
And in many cases, for example, in many cases, the code we copy has a number at the front, and if there are numbers in front of hundreds of lines of code, we can replace them with rules.
For example:
1 alert ("); 2 var str=" I love antzone\ n and you 360 "; 3 var reg=/\ d G; 4console.log (str.match (reg))
For example, the following rule
^ [0-9] *.
You can perfectly replace the previous number.
The above is all the contents of the article "how to use regular expressions\ d metacharacters". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.