RegExp.lastParen
JavaScript 1.2+, JScript 3.0+ Nav4+, NES3+, IE4+ Syntax
regexp.lastParen
Description
The lastParen property of the RegExp object represents the last parenthesized substring match. It returns a string value for the last parenthesized substring.
Example
Listing 6.221 shows how the lastParen property is used.
Listing 6.221 Example of lastParen Property
<html> <body> <script language="JavaScript"> <!–– Hide // define a regular expression exp = new RegExp("(please)", "g"); // create a string object str = "Will you (please) stop yelling!"; myArray = exp.exec(str); // inform user what the lastParen property is document.write("The RegExp.lastParen is: " + "<b>" + RegExp.lastParen + "</b>"); // End Hide ––> </script> </body> ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.