Regular expressions have the adverse reputation of being exceedingly difficult to author and read.
Here are some recommendations that will help you make the most of regular expressions:
As you begin developing regular expressions, always assume that you may need to reference the expression again at a future time by backing up this code in a separate text file. One way to preserve these patterns would be to store them in the Dreamweaver Snippets panel. However, since not everyone necessarily remembers to back up his or her Dreamweaver snippets, it makes good sense to back up this information in a text file. I can speak from experience when I say it's terribly frustrating to recreate a complex regular expression when there's a lingering sense of déjà vu in the back of your mind that you've already solved this problem before. Dreamweaver enables you to save your queries as XML files so that they can be loaded later (see Figure 15). While there are advantages to using this feature, I still encourage you to have a separate text file where you can collect and reference all of your regular expressions. Dreamweaver stores these regular expressions as XML files that are not easy to parse mentally and each query is stored as a separate file.
Figure 15: The Find and Replace dialog box pointing out the Save Query button
Mastering regular expressions requires the patience of a scientist and the skill of an artist. If you are new to regular expressions, it's important to realize that it takes practice before you can fully unravel the powers of regular expressions. As you begin to develop a basic understanding of the syntax, you will begin to uncover new techniques and build a greater level of confidence. I encourage you to practice by coming up with some regular expressions on your own that solve useful problems. The additional resources listed below will also prove helpful.