Interface JSRegExpFunctions

    • Method Detail

      • exec

        JSArray exec​(java.lang.String string)
        function exec(string) general purpose pattern matching.

        Example

         var r = new RegExp("/\bJava\w*\b/g");
         var text = "JavaScript is not the same as Java";
         while((result = e.exec(text)) != null)
         {
           alert("Matched: " + result[0]);
         }
         
        Parameters:
        string - The string to be searched
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        RegExp, test()
      • test

        JSBoolean test​(java.lang.String string)
        function test(string) test whether a string matches a pattern.

        Example

         var r = new RegExp("/java/i");
         r.test("JavaScript"); //returns true
         r.test("ECMAScript"); //returns false
         
        Parameters:
        string - The string to be tested
        Since:
        Standard ECMA-262 3rd. Edition, Level 2 Document Object Model Core Definition.
        See Also:
        RegExp, exec()