August 1999
Intermediate to advanced
1488 pages
72h 53m
English
RegExp.$&
The RegExp.$& property represents the last matched characters. This is the same as using the lastMatch property.
Listing 6.208 shows how RegExp.$& 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