FrontPage Regular Expressions

FrontPage 2003 added regular expressions to its Find and Replace tool. This is a big improvement and allows for more powerful code editing. Unfortunately, it requires a lot of trial and error to figure out its regular expression syntax which differs from UNIX style syntax.

One of the more useful regular expressions I’ve come up with is to replace my old method of referring to a form field in JavaScript with my new method which is more compatible with various web browsers. The old method would use something like document.forms[“name”].elements[“name”].value which would break if you change the form name. The better method is to use document.getElementById(“name”).value which doesn’t even use the form name.

My FrontPage Regular Expression changes the syntax of the JavaScript:

Find: document.forms(.)*elements[
Replace: document.getElementById(

You must remember to change the closing bracket to a ) and to insert id attributes to your form fields if you did not use them.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.