August 1999
Intermediate to advanced
1488 pages
72h 53m
English
regexp.lastMatch
The lastMatch property of the RegExp object represents the last matched characters.
Listing 6.220 shows how the lastMatch property is used.
<html>
<body>
<script language="JavaScript">
<!–– Hide
// define a pattern to search for
var pat = new RegExp("test", "gi");
str = "Testing Testing 123";
myArray = pat.exec(str);
// Once pattern is found, display message.
document.write("Pattern found: " + myArray[0] +
". the last match expression is: " + RegExp.lastMatch);
// End Hide ––>
</script>
</body>
</html>
|
Read now
Unlock full access