How to use regular expression\ D metacharacters
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!