Post Reply 
Correct link targets (site-specific, list-based)
Nov. 03, 2012, 09:04 PM
Post: #2
RE: Correct link targets (site-specific, list-based)
duebel13 Wrote:1.) The initial idea was to use positional variables instead of global variables but I've actually given up on this. Basically, what I originally intended was using $SET(0= instead of $SET(href=, and $SET(1= instead of $SET(target= in the list. But positional variables always expanded to nothing, wether I was using \0 or $TST(\0). Any idea what I might be missing?

I don't think positional variables created in the URL Match survive to be used later in the filter. Also browse
http://sidki.proxfilter.net/prox/sidki-e...niques.txt

duebel13 Wrote:2.) I'd like to use matching in the href part of the lists.

Changes.txt Wrote:or also just...
$TST(variable)
can be used in a match to see if the variable's contents match
the current text. For example..
src="http://$TST(myhost)/"
note that this must be a literal match (except for case) - the variable's
value isn't treated as a matching expression with wildcards and such.

duebel13 Wrote:I' really stuck and would appreciate any help. Thanks.

Using your current work, I suspect that where you have "$TST(href)" you will want to call a list or reference an array.

For example, CorrectLinkTargets-S might look like

Code:
www.ebay.de/[^\?]++/i.html            $SET(href=www.ebay.de/)
www.ebay.com/[^\?]++/i.html           $SET(href=www.ebay.com/)
www.ebay.co.uk/[^\?]++/i.html         $SET(href=www.ebay.co.uk/)
/itm/& $TST(href=www.ebay.(de|com|co.uk)/)


*/forumdisplay.php                            $SET(href=*/forumdisplay.php)
*/(show|view)thread.php& $TST(href=*/forumdisplay.php)

and your filter might look like

Code:
Name = "Links: Correct Target (Site-specifc, HTML) [dbl]"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)$LST(CorrectLinkTargets-S)"
Bounds = "$NEST(<a\s,>)"
Limit = 512
Match = "\2( target=$AV(\4)|)(\3)>"
        "&"
        "*href=$AV(($LST(CorrectLinkTargets-S)*)\5)"
        "&"
        "((^$TST(target=*))($TST(\5=*.(7z|zip|rar|exe|msi|pdf|tgz|gz|rpm|iso)(\?*|))"
        "$SET(1=_self)|$SET(1=_blank))|$SET(1=$GET(target)))"
Replace = "\2\3 target="\1">"

An array (using @ to separate possible values) could look something like

Code:
www.ebay.de/[^\?]++/i.html            $SET(href=@/itm/@)
www.ebay.com/[^\?]++/i.html           $SET(href=@/itm/@)
www.ebay.co.uk/[^\?]++/i.html         $SET(href=@/itm/@)

*/forumdisplay.php                            $SET(href=@/showthread.php@/viewthread.php@)

The expression to use the array (if possible), I will have to post later.

I'd probably add something to the filter to clear the "href" variable when work is done. Also, I have not tested the filter and list...



HTH

Changes.txt in the Proxomitron's Docs folder or http://www.proxomitron.info/45/docs/Changes.txt
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Correct link targets (site-specific, list-based) - JJoe - Nov. 03, 2012 09:04 PM

Forum Jump: