Post Reply 
Adding keywords with an incrementing counter
May. 08, 2011, 04:37 PM
Post: #2
RE: Adding keywords with an incrementing counter
Adding a keyword and a counter seems reasonable, I guess.

Quote:which obviuously doesn't work

Maybe some examples

Code:
[Patterns]
Name = "Count <div Example 1"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "<div"
        "$TST(($GET(DivCount)+)=$LST(Count)|*)$SET(DivCount=$GET(i))"
        "PrxFail$TST()"
        "|"
        "(^(^<ProxBottom>))$STOP()"
        "$SET(keyword=$GET(keyword).DivCount=$GET(DivCount).)"
        "$SET(DivCount=)"
        "PrxFail$TST()"

Code:
[Patterns]
Name = "Count <div Example 2"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "<div"
        "$TST(($GET(DivCount)+)=$LST(Count)|*)$SET(DivCount=$GET(i))"
        "$TST(keyword=.(*.)\0DivCount*.\1|.+\0)"
        "$SET(keyword=.\0DivCount=$GET(DivCount).\1)"
        "PrxFail$TST()"
        "|"
        "(^(^<ProxBottom>))$STOP()"
        "$SET(DivCount=)"
        "PrxFail$TST()"

I've used PrxFail$TST() to break the match but the variables are still set.
Example 1 should be quickest and easiest to add to your filter.
Example 2 preserves keyword order.

Notes:
Both examples preserve any existing keyword info.
$SET(keyword=some.noindex_strip:2) would overwrite the existing or current keyword and probably isn't what you want to do.

Use a named (global) variable to share info between filtering events. Variables \0-9 are per filter and lost when a filter closes.

HTH
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Adding keywords with an incrementing counter - JJoe - May. 08, 2011 04:37 PM

Forum Jump: