Tag:RegExp

  • VBS tutorial: objects – regular expression (regexp) objects

    Time:2021-12-2

    Regular expression (regexp) objectProvides simple regular expression support. explainThe following code illustrates the usage of regexp object: Function RegExpTest(patrn, strng) Dim regex, match, matches’ create variables. Set regex = new regexp ‘establish a regular expression. Regex. Pattern = pattern ‘sets the pattern. Regex.ignorecase = true ‘sets whether characters are case sensitive. Regex. Global = true […]

  • What is the difference between JS regular expression literals and regular expressions created using the new regexp constructor

    Time:2021-10-27

    When we only use character replacement in JS, we often encounter two writing methods, direct literal 1、str.replace(/&nbsp;/ig,””); 2. New regexp Test code <form name=form1> String: < input name = “T1” value = “123456” > Mode: / < input name = “T2” value = “^ \ d * $” >/ </form> <script language=javascript> function c1() { […]

  • Methods and properties of regexp object

    Time:2021-9-11

    Test (): judge whether a string matches the specified patternExec(): returns an array. The first entry in the array is the first match, and the others are backreferencesMatch (): returns an array of all matches contained in the stringSearch(): returns the position of the first match in the stringReplace (): replace all matches in a […]

  • JavaScript regexp object (regular expression)

    Time:2021-7-28

    Use the explicit constructor of regexp. The syntax is: new regexp (“pattern” [, “flags”]).Use the implicit constructor of regexp in plain text format: / pattern / [flags].The pattern part is the regular expression pattern text to be used, which is required. In the first method, the pattern part exists as a JavaScript string and needs […]

  • Properties, methods and applications of JavaScript regexp object

    Time:2021-6-2

    JavaScript provides a regexp object to complete the operation and function of regular expressions. Each regular expression pattern corresponds to a regexp instance. There are two ways to create instances of regexp objects. Use the explicit constructor of regexp with the syntax: new regexp (“pattern” [, “flags”]).The implicit constructor of regexp is used, and the […]

  • Regexp property, method and application analysis of JavaScript regular expression

    Time:2021-5-13

    Use the explicit constructor of regexp with the syntax: new regexp (“pattern” [, “flags”]).The implicit constructor of regexp is used, and the plain text format is adopted: pattern / [flags].The pattern section is the regular expression pattern text to be used and is required. In the first way, the pattern part is in the form […]

  • The influence of JavaScript regexp multiline on multiline matching^$

    Time:2021-4-26

    It’s all in the notes — Copy codeThe code is as follows: <script type=”text/javascript“> /^$/.test(‘\n’); // The explanation is as follows var p = /^/mg; var s = ‘1\n\n\n2\n\n3’; p.test(s); // Skip start position JS doesn’t seem to have that word —p.test(s); alert(RegExp.rightContext.replace(/\x0A/g, ‘\\a’)); //It is concluded that ^ matches the position after or at […]

  • About IE RegExp.exec The question of

    Time:2021-4-24

    The code is as follows: Copy codeThe code is as follows: var st=”A[B]C[D]E[F]G”; var reg =/\[\w\]/ig; var s1 = st.replace(reg,””); var s2=[]; var arr; while((arr=reg.exec(st))!=null)s2.push(arr[0]); alert(s1); alert(s2.join(“”)); FF is displayed correctly, and S2 is empty in ie Online information can not be found, please give me some advice I got an unexpected result during the […]

  • JavaScript regexp regular expression object details

    Time:2021-3-15

    Direct quantity grammar/pattern/attributes Syntax for creating regexp objects: Copy codeThe code is as follows: var obj=new RegExp(pattern,attributes); Case 1: Copy codeThe code is as follows: var pattern=/a/; document.write(pattern.exec(“asdas”)); Case 2: Copy codeThe code is as follows: var obj=new RegExp(“a”); document.write(obj.exec(“asdas”)); The results of case 1 and case 2 are the same;parameterThe parameter pattern is a […]

  • ASP regexp object regular expression function usage

    Time:2021-2-11

    Regexp object provides simple regular expression support.Usage of regexp object: Copy codeThe code is as follows: Function RegExpTest(patrn, strng) Dim regex, match, matches’ create variables.Set regex = new regexp’creates a regular expression.regEx.Pattern =PATRN ‘setting mode.regEx.IgnoreCase =True ‘sets whether characters are case sensitive.regEx.Global =True ‘sets global availability.Set Matches = regEx.Execute (strng) ‘to perform the search.For each […]

  • Compile method of regexp object of JS regular expression

    Time:2020-11-6

    Function Description: this method can compile the specified regular expression, and the execution speed of the compiled regular expression will be improved. If the regular expression is called multiple times, calling the compile method can effectively improve the code execution speed. If the regular expression can only be used once, it will not have obvious […]

  • JS regular expression input property ($_ )Introduction to regexp object properties

    Time:2020-11-3

    Function Description: this property is a static read-only property of regexp. The value of this property is the string for matching detection with the regular expression described by regexp object. This property can also be expressed as$_ Copy codeThe code is as follows: <html> <script language=”javascript” type=”text/javascript”> //Objstr is the content to be matchedvar objStr=’abcDdefCDDE’; […]