|
February 23, 2000 IE 5.5's Enhanced replace() Function Tips: February 2000
Yehuda Shiran, Ph.D.
|
|
Internet Explorer 5.5's replace()
function supports more features than version 5.0. In IE 5.0, the replace()
function uses two parameters: a regular expression and a replacement string. In
IE 5.5, the function uses two parameters as well, but the second one is a handling
function that utilizes the replacement in a more intensive manner. Let's take
an example.
We first define a regular expression:
This regular expression will
match a string that includes a word, followed by a zero number or more of blanks,
and ends with a word. The flag
A submatch is found according to the parenthesis in the regular expression. The first pair defines You can do anything inside the
matching function. At the end you have to return a string. In our case above,
we return a concatenation of the submatches. The Learn more about IE 5.5 in Column 57, The Doc Dialer, Part I.
People who read this tip also read these tips: Look for similar tips by subject: |