/***************************************************************************
* REGULAR EXPRESSIONS FOR TST-ENABLING A WEBSITE 
*
* Using a text-editor with regular expression support, these
* regular expressions can be used to batch-process the files that make
* up a website, greatly speeding-up the process of adding
* Total Sales Tracking
*
* Author: Richard Knight (RAK)
* © Digital Mail Limited 2005
***************************************************************************/

COPY AND PASTE THE FOLLOWING INTO THE find AND replace FIELDS OF YOUR
REGEXP-ENABLED TEXT EDITOR, WITHOUT INCLUDING THE LINEBREAK AT THE END
OF THE LINE!

===============================================================================

FOR BBEdit, EditPadPro, Adobe Golive AND MultiEdit USING PERL-STYLE REGULAR EXPRESSIONS,
AND OTHER EDITORS THAT USE \N TO REFERENCE TAGGED SUBPATTERNS:

(1) Add the event-handler to links
----------------------------------
Find:
<a\s+(?!href=['|"]?#)(?!name=)(?!.*onclick="return tst_follow_link\(this\);")(.*?)>

Replace with:
<a \1 onclick="return tst_follow_link(this);">



(2) Add the event-handler to forms
----------------------------------
Find:
<form\s+(?!.*onclick="tst_submit_form\(this\);")(.*?)>

Replace with:
<form \1 onclick="tst_submit_form(this);">
