The Un-Official Proxomitron Forum
Counting Run-On's - Printable Version

+- The Un-Official Proxomitron Forum (https://www.prxbx.com/forums)
+-- Forum: Proxomitron Filters (/forumdisplay.php?fid=38)
+--- Forum: Others (/forumdisplay.php?fid=11)
+--- Thread: Counting Run-On's (/showthread.php?tid=2101)



Counting Run-On's - ProxRocks - May. 23, 2013 11:48 PM

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...


RE: Counting Run-On's - JJoe - May. 24, 2013 12:41 AM

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


RE: Counting Run-On's - ProxRocks - May. 24, 2013 01:59 AM

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?


RE: Counting Run-On's - JJoe - May. 24, 2013 02:11 AM

(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.


RE: Counting Run-On's - ProxRocks - May. 24, 2013 11:07 AM

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...


RE: Counting Run-On's - JJoe - May. 24, 2013 09:46 PM

(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


RE: Counting Run-On's - ProxRocks - May. 24, 2013 11:02 PM

how much of an advantage is there to go "without n" versus the "with n" version?


RE: Counting Run-On's - JJoe - May. 25, 2013 02:44 AM

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.


RE: Counting Run-On's - ProxRocks - May. 25, 2013 03:00 AM

cool...
i'll run with the newer i version...

thanks again...