Search pattern and message template macros WatzNew utilizes a simple to create yet powerful search pattern scheme to retrieve specific data from html pages. When the data is retrieved, WatzNew takes the message template to form a user-friendly message. Search pattern macros | | | | · | {*} means 'any text'. | | · | {%} means 'next parameter'. | | · | {%,N} means 'next parameter takes exactly N following characters'. |
Message template macros | | | | · | %1 means 'the first parameter'. | | · | %2 means 'the second parameter'. | | · | %3 means 'the third parameter'. | | · | ... | | · | %N means 'the N-th parameter' and so on. | | · | \n means 'new line' (line break). | | · | <BR> means 'new line' (same as \n). | | · | <LI> means 'new list item' (the text after this macro appears on the next line indented and marked with a bullet). | | · | <B>...</B> make the text inside appear as bold (like in html). | | · | <I>...</I> make the text inside appear as italic. | | · | <U>...</U> make the text inside appear as underlined. |
Date / Time macros These macros can be used in both search pattern and message templates. They are case-sensitive: | | | | · | %Y - 4-digit year value. | | · | %YY - 2-digit zero-padded year value. | | · | %M - month value. | | · | %MM - 2-digit zero-padded month value. | | · | %MMM - short month name ('Jan', 'Feb', etc.). | | · | %MMMM - full month name ('January', 'February', etc.). | | · | %D - day value. | | · | %DD - 2-digit zero-padded day value. | | · | %W - 1-digit day of the week value (1 — Sunday, 2 — Monday, ..., 7 — Saturday). | | · | %WW - 2-digit day of the week value (1 — Sunday, 2 — Monday, ..., 7 — Saturday). | | · | %WWW - short day name ('Sun', 'Mon', etc.). | | · | %WWWW - full day name ('Sunday', 'Monday', etc.). | | · | %w - 1-digit day of the week value (1 — Monday, 2 — Tuesday, ..., 7 — Sunday). | | · | %ww - 2-digit day of the week value (1 — Monday, 2 — Tuesday, ..., 7 — Sunday). | | · | %h - hour value. | | · | %hh - 2-digit zero-padded hour value. | | · | %m - minutes value. | | · | %mm - 2-digit zero-padded minutes value. | | · | %s - seconds value. | | · | %ss - 2-digit zero-padded seconds value. |
You can add prefixes to the date / time macros. These are case-sensitive: | | | | · | Msg - for the message date / time. | | · | Last - for the last check date / time. |
This means that if you use %MsgY, the message date's year value will be used; %LastDD — last try date's day value will be used and so on. With no prefix, the current date and time are used. Simple example When the html page is loaded, WatzNew applies the search pattern first. The date / time macros are inserted before the search is performed, so you can make date-based search. Sample search pattern: This means: find the first occurence of <H1> in the html document and treat any text between it and the following occurence of </H1> as the first parameter (that corresponds to %1 in message template). |
Then the found parameters are inserted in the message template. Sample message template: This means: substitute %1 with the first parameter found. |
If we apply the above rules to the following sample html document ... <BODY> <H1>"How to become rich?" by John Poor</H1> ... </BODY> | we will get "Current article: "How to become rich?" by John Poor" message.Now, when the text between <H1> and </H1> is changed, we will be notified with such a message as soon as WatzNew checks the channel for updates. Note: Pattern search is case-insensitive but date / time macros that are inserted before search, are case-sensitive; each found parameter is processed on the following scheme: html tags (simply all text between < and >) are stripped; all are converted to spaces; all &nn; and &nnn; and such codes as ©, ®, " are converted to corresponding characters; the resulting strings are trimmed (all leading and trailing spaces and control characters are removed). |
Please look at more complex example of using search patterns and message templates. Table Of Contents |