Has anyone experimented with IF-THEN logical stuctures in filters. I realize that well written filters may contain IF-THEN structures that perhaps were not thought of as such at the time of creation but has anyone created any filters where they had implied IF-THEN or IF-THEN-ELSE structures in mind? I've not seen anybody explore this idea but it might greatly simplify the process of filter creation by the use of filter templates.
Here is a comment viewer filter I wrote with an implied IF-THEN-ELSE structure.
Name = "Comment Viewer"
Active = TRUE
Limit = 4
Match = "(<!--$SET(1=<small><!--))|"
"(-->$SET(1=--></small>))"
Replace = "1"
Written out the match logic is
IF "<!--" is matched
THEN set the variable "1" equal to "<small><!--"
ELSE IF "-->" is matched
THEN set the variable "1" equal to "--></small>"
altosax's "Add </head> tag when missing" filter uses an implied IF-THEN-ELSE structure.
Name = "Add </head> tag when missing - altosax v2"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)"
Limit = 7
Match = "(</head>)1$STOP()|(<body)2$SET(1=</head>)"
Replace = "12$STOP()"
IF "</head>" is matched
THEN store "</head>" in variable "1" and stop using filter here
ELSE IF "<body" is matched
THEN store "<body" in variable "2" and set variable "1" equal to "</head>"
The filters are just simple examples but any ideas on the concept and how it might be extended to more complex structures?
Facing each other,
a thousand miles apart.
Edited by - hpguru on 21 Aug 2002 19:12:26