The literal notation, for example, /ab+c/
, provides compilation of the
regular expression once when the expression is evaluated. Use literal notation when the
regular expression will remain constant. For example, if you use literal notation to
construct a regular expression used in a loop, the regular expression won't be recompiled
on each interation.
<SCRIPT LANGUAGE="JavaScript1.2">
A = ["Frank", "Emily", "Jane", "Harry", "Nick", "Beth", "Rick", \
"Terrence", "Carol", "Ann", "Terry", "Frank", "Alice", "Rick", \
"Bill", "Tom", "Fiona", "Jane", "William", "Joan", "Beth"]
re = /\w+/i