Regular expression learning notes (1)

zhaozj2021-02-16  106

This time is ready to be familiar with the regular expression.

Let's first talk about something less related, some history about JavaScript. Yesterday, I went to the North Total to check the information about the regular expression, because I didn't find a book specifically to express the express expression, so I found a JavaScript authoritative guide for Oreilly. When JavaScript1.5 is started to see JavaScript1.5, Netscape has two versions of JavaScript interpretation, namely Spidermonkey (C Edition), Rhino (Java Edition). Developers can embed the JavaScript interpreter in any place where you want to use this scripting language.

Next, it is necessary to talk about the application of Regular Expression in JavaScript. Regular expressions in JavaScript are represented by the regexp object, create with the regexp () constructor, of course, can also be used in text format. The regexp () constructor is as follows:

New regexp ("pattern" ["" ") Parameters: pattern: text Flags: G: Global Match (Quality Match) GI: Both Global Match and Ignore, IGNORE CASE (ignition) Case (simultaneous matches and ignore cases), for example: new regexp ("[^ ADM] / S", "i") text format is as follows: [^ ADM] / S

Function GetInfo (ABC) {RE = / (W ) S (D ) /; Re.exec (abc.value); Window.alert (Regexp. $ 1 ", Your Age IS" Regexp. $ 2);}

转载请注明原文地址:https://www.9cbs.com/read-10313.html

New Post(0)