WatzNew Logo

Complex example of using search patterns

This example will show you the power of WatzNew. Assume we have the following html page and want to track new releases of software called ABC Html Colorizer.

...
<BODY>

<H1>ABCSoft. Our software:</H1>

<H2>ABC E-mail Checker</H2>
<UL>
<LI>Latest release date: 01-Apr-1999
<LI><A href="abc_checker.zip">Download v.1.15 now!</A> - 433 KB ZIP archive
<LI><A href="abc_checker_help.zip">Help file in .HLP format</A> - 39 KB ZIP archive
</UL>

<H2>ABC Html Colorizer</H2>
<UL>
<LI>Latest release date: 03-Apr-1999
<LI><A href="abc_htmlcolor.zip">Download v.1.30 now!</A> - 172 KB ZIP archive
<LI><A href="abc_htmlcolor_help.zip">Help file in .HLP format</A> - 60 KB ZIP archive
</UL>

...
</BODY>

Our search pattern would be:

<H2>ABC Html Colorizer</H2>{*}<LI>Download v.{%}now!

This means:

·

find the first occurence of <H2>ABC Html Colorizer</H2> in the html document;

·

skip any number of characters until the <LI>Download v. substring is found;

·

treat any text between it and the following occurence of now! as the first parameter (that corresponds to %1 in message template).

and the message template would be:

Current version of ABC Html Colorizer is %1

If we apply the above rules to our html document we will get "Current version of ABC Html Colorizer is 1.30" message.

And what if we want to track not only the software version but the release date and ZIP file size? Let's modify our search pattern:

<H2>ABC Html Colorizer</H2>{*}<LI>Latest release date:{%}<LI>Download v.{%}now! -{%}ZIP archive

This means:

·

find the first occurence of <H2>ABC Html Colorizer</H2> in the html document;

·

skip any number of characters until the <LI>Latest release date: substring is found;

·

treat any text between it and the following occurence of <LI>Download v. as the first parameter (that corresponds to %1 in message template);

·

treat any text between <LI>Download v. and the following occurence of now! - as the second parameter (%2 in message template);

·

treat any text between now! - and the following occurence of ZIP archive as the third parameter (%3 in message template).

So, we must eventually get the release date, version and file size in %1, %2 and %3 parameters respectively. Let's modify our message template:

Current version of ABC Html Colorizer is %2 (%3), released on %1

If we apply the above rules to our html document we will get "Current version of ABC Html Colorizer is 1.30 (172 KB), released on 03-Apr-1999" message.

Table Of Contents

Tip