Previous Example-|-Next Example-|-Return to Chapter Listing
Example 14.18:
Regular Expressions - Remembering the Matched Expression
[This example works with Netscape Navigator 4. It won't work with Netscape Navigator 2 or 3, or Internet Explorer 3.]
This script remembers what it finds. Type a phone number into the text box; use groups of 3, 3, and 4 characters, and any other non-digit characters you want (303) 555-1234, for instance, or 303+555+1234, or even 303x555x1234. The script will extract the phone number and display it in an alert box.
Here's the function:
Here's the form:
Previous Example-|-Next Example-|-Return to Chapter Listing