The Un-Official Proxomitron Forum

Full Version: Counting Run-On's
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there a way to count [using LST(count) perhaps] how many TIMES a "repeat" is 'repeated'?

ie, let's say my filter match line is this, "([.-])\1+{4,2048}"...

is there a way for the filter replace line to tell me if there were FOUR dots back-to-back or if there were FORTY dots back-to-back?

something where the web page will show ...[+1] if there were FOUR dots or will display ...[+37] if there were FORTY dots...
and in turn will display ...[+1834] if there were originally 1837 dots...
Something like

Code:
[Patterns]
Name = "Example 1"
Active = FALSE
Limit = 2048
Match = "([.-])+{3}"
        "(([.-]$TST(($GET(n)+)=$LST(Count)|*)$SET(n=$GET(i)))+{1,2045})\1"
Replace = "....\1"
          "[+$GET(n)]\r\n"
          "$SET(n=)$SET(i=)"

If you don't need n

Code:
[Patterns]
Name = "Example 2"
Active = FALSE
Limit = 2048
Match = "([.-])+{3}"
        "(([.-]$TST(($GET(i)+)=$LST(Count)|*))+{1,2045})\1"
Replace = "....\1"
          "[+$GET(i)]\r\n"
          "$SET(i=)"

Note that $LST(Count) uses \0.

HTH

Edit:Limit=2048
looks good, will test in the morning...

i'm curious as to the limit being 2045...
while my original 2048 is arbitrary, with the first three being caught by the first match line and 2045 being caught by the second line, if we did need to catch 2048, wouldn't the limit line be 2048 and the second line still be 2045?
(May. 24, 2013 01:59 AM)ProxRocks Wrote: [ -> ]wouldn't the limit line be 2048 and the second line still be 2045?

You are correct. And it was 2048 and 2045 at one time, lol. I must be doing (or trying to do) too many things at once.

Have fun.
the "with n" version works like a charm...

without the n, the FIRST match for the filter will display the wrong count (perhaps the "i" from another filter)...


much appreciated...
(May. 24, 2013 11:07 AM)ProxRocks Wrote: [ -> ]without the n, the FIRST match for the filter will display the wrong count (perhaps the "i" from another filter)...

Correct again. When sidki used that format he initialize the value of i. I didn't see where he finally cleared it, if ever.

You could

Code:
[Patterns]
Name = "Example 2a"
Active = FALSE
Limit = 2048
Match = "([.-])+{3}$SET(i=)"
        "(([.-]$TST(($GET(i)+)=$LST(Count)|*))+{1,2045})\1"
Replace = "....\1"
          "[+$GET(i)]\r\n"
          "$SET(i=)"

Thanks
how much of an advantage is there to go "without n" versus the "with n" version?
That depends on the number of loops. With n each loop executes $SET(n=$GET(i)). The n version could be milliseconds slower.

Given 2048 dots:
i version profiles at 18.247024 (milliseconds)
n version profiles at 28.947115 (milliseconds)

They fail in the same amount of time.

Probably seems silly to most but it is something that I consider.
cool...
i'll run with the newer i version...

thanks again...
Reference URL's