The Un-Official Proxomitron Forum

Full Version: Limiting container tab scope
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all. i've been playing around with filters again and ran into a problem with limiting the match to just one container tag.
Code:
[Patterns]
Name = "TXT: add title select sites {sh8an}"
Active = TRUE
URL = "$TYPE(htm)$LST(TitleAdd)"
Limit = 254
Match = "(<(div|tr)\1 \0</$TST(\1)>)\9"
        "$TST(sTXTmod=§\3§\4§\5$TST(\0=*($TST(\3)*($TST(\4)) \8($TST(\5)))*))"
Replace = "\9\r\n"
          "<script language="javascript">\r\n"
          "    $SET(uRepl=document.title$TST(uRepl=*).replace(/$GET(uRepl)/g, ""))"
          "    document.title = $GET(uRepl) + '\8';\r\n"
          "</script>\r\n"
          "$SET(uRepl=)"
matches
Code:
<div class="tableborder">
        <div class='maintitle'><img src='/forum/style_images/nav_m.gif' border='0'  alt='&gt;' width='8' height='8' />&nbsp;<b>Image Grabbers</b>, download links</div>
while the first div should be skipped.
Any suggestions?

Update:
Code:
(<(div|tr)\1 \0</$TST(\1)>)\9(^$TST(\0=*$TST(\1)*))
$TST(sTXTmod=§\3§\4§\5$TST(\0=*($TST(\3)*($TST(\4)) \8($TST(\5)))*))
does the trick. but is this the right way or doing it?
What about:

Code:
(<(div|tr)\1(^*<$TST(\1)) \0</$TST(\1)>)\9
(Apr. 14, 2011 03:24 PM)whenever Wrote: [ -> ]What about:

Code:
(<(div|tr)\1(^*<$TST(\1)) \0</$TST(\1)>)\9

It fails to match <div></div><div>. It is a good idea and I use it but I think it needs more code.

Before $TST, I might try something like

Code:
(<(
((div*</div) >&&(^*<div*)*)
|
((tr*</tr) >&&(^*<tr*)*))
)\9

After $TST, I might try something like

Code:
(<(
(div*<(/+div)\1)+{1}$TST(\1=/div) >
|
(tr*<(/+tr)\1)+{1}$TST(\1=/tr) >)
)\9

This last example should be fastest.

I think.

HTH

Edit: Removed \s added some parentheses. Should work now. Sorry.
(Apr. 14, 2011 03:24 PM)whenever Wrote: [ -> ]What about:
Code:
(<(div|tr)\1(^*<$TST(\1)) \0</$TST(\1)>)\9
didn't match.

(Apr. 15, 2011 02:53 AM)JJoe Wrote: [ -> ]After $TST, I might try something like....
did'nt quite get but will try to figure it out.

my problem was that <div*><div*></div> matched (not <*div></div><div*>), while the match should have been limited to only one div container (ie <div*></div>)

changed the update again to be more stricter and match only tags
Code:
(<(div|tr)\1 \0</$TST(\1)>)\9(^$TST(\0=*<$TST(\1)*))
Reference URL's