It is currently June 30th, 2024, 11:05 pm

Substitute Limit?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7583
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Substitute Limit?

Post by Yincognito »

Quick question, as I'm trying various ways to "insert" some numbers from a string into another string, using a Substitute option: is there a limit to the number of comma separated "pattern":"replacement" pairs in this option, or their number is unlimited?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Brian
Developer
Posts: 2701
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Substitute Limit?

Post by Brian »

I think it is more limited to the number of characters in the entire section. I believe a section's size can be no more than 32767 characters. That includes each key=value pair and newlines.

Also, I believe there is a hard limit of 100 for regexp replacements.

-Brian
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Substitute Limit?

Post by jsmorley »

Brian wrote: July 16th, 2020, 10:45 pm I think it is more limited to the number of characters in the entire section. I believe a section's size can be no more than 32767 characters. That includes each key=value pair and newlines.

Also, I believe there is a hard limit of 100 for regexp replacements.

-Brian
Just a nitpick, but isn't it 99?
User avatar
Brian
Developer
Posts: 2701
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Substitute Limit?

Post by Brian »

jsmorley wrote: July 16th, 2020, 10:49 pm Just a nitpick, but isn't it 99?
You're probably right. I bet the "entire" string is the first one, then 99 indices after that.

-Brian
User avatar
Yincognito
Rainmeter Sage
Posts: 7583
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Substitute Limit?

Post by Yincognito »

Brian wrote: July 16th, 2020, 10:45 pmI think it is more limited to the number of characters in the entire section. I believe a section's size can be no more than 32767 characters. That includes each key=value pair and newlines.
Hmm...that's interesting for sure. Good to know - thanks.
Brian wrote: July 16th, 2020, 10:45 pmAlso, I believe there is a hard limit of 100 for regexp replacements.
jsmorley wrote: July 16th, 2020, 10:49 pmJust a nitpick, but isn't it 99?
So, are you talking about the capture limit, or the number of comma delimited "pattern":"replacement" pairs? Cause I'm interested in the later, really, as the former can easily be "defeated". That would be unfortunate if there was such a low limit for those pairs...

P.S. You know... Substitute="A":"B","C":"D","E":"F" has 3 of those pairs. I'm talking, of course, about RegExp pairs, can't remember when I last time used "normal" ones, they seem so ... weak in comparison. Don't tell me I can't have more than 99 or 100 of them... O.O

UPDATE: Just tested, with my now working "automatic line number insertion" method, a !WriteKeyValue to see the result and some copy pasting to grow the number of lines and associated "pattern":"replacement" pairs, and it seems it works for more than 100 of them :cheer: :

Code: Select all

[Variables]
Menu=
0	Submenu 0
1		Submenu 0.0
2			Submenu 0.0.0
3				Submenu 0.0.0.0
4					Submenu 0.0.0.0.0
5					Submenu 0.0.0.0.1
6			Submenu 0.0.1
7		Submenu 0.1
8	Submenu 1
9		Submenu 1.0
10	Submenu 2
11		Submenu 2.0
12			Submenu 2.0.0
13			Submenu 2.0.1
14				Submenu 2.0.1.0
15					Submenu 2.0.1.0.0
16		Submenu 2.1
17			Submenu 2.1.0
18		Submenu 2.2
19			Submenu 2.2.0
20			Submenu 2.2.1
21				Submenu 2.2.1.0
22				Submenu 2.2.1.1
23				Submenu 2.2.1.2
24			Submenu 2.2.2
25	Submenu 3
26	Submenu 0
27		Submenu 0.0
28			Submenu 0.0.0
29				Submenu 0.0.0.0
30					Submenu 0.0.0.0.0
31					Submenu 0.0.0.0.1
32			Submenu 0.0.1
33		Submenu 0.1
34	Submenu 1
35		Submenu 1.0
36	Submenu 2
37		Submenu 2.0
38			Submenu 2.0.0
39			Submenu 2.0.1
40				Submenu 2.0.1.0
41					Submenu 2.0.1.0.0
42		Submenu 2.1
43			Submenu 2.1.0
44		Submenu 2.2
45			Submenu 2.2.0
46			Submenu 2.2.1
47				Submenu 2.2.1.0
48				Submenu 2.2.1.1
49				Submenu 2.2.1.2
50			Submenu 2.2.2
51	Submenu 3
52	Submenu 0
53		Submenu 0.0
54			Submenu 0.0.0
55				Submenu 0.0.0.0
56					Submenu 0.0.0.0.0
57					Submenu 0.0.0.0.1
58			Submenu 0.0.1
59		Submenu 0.1
60	Submenu 1
61		Submenu 1.0
62	Submenu 2
63		Submenu 2.0
64			Submenu 2.0.0
65			Submenu 2.0.1
66				Submenu 2.0.1.0
67					Submenu 2.0.1.0.0
68		Submenu 2.1
69			Submenu 2.1.0
70		Submenu 2.2
71			Submenu 2.2.0
72			Submenu 2.2.1
73				Submenu 2.2.1.0
74				Submenu 2.2.1.1
75				Submenu 2.2.1.2
76			Submenu 2.2.2
77	Submenu 3
78	Submenu 0
79		Submenu 0.0
80			Submenu 0.0.0
81				Submenu 0.0.0.0
82					Submenu 0.0.0.0.0
83					Submenu 0.0.0.0.1
84			Submenu 0.0.1
85		Submenu 0.1
86	Submenu 1
87		Submenu 1.0
88	Submenu 2
89		Submenu 2.0
90			Submenu 2.0.0
91			Submenu 2.0.1
92				Submenu 2.0.1.0
93					Submenu 2.0.1.0.0
94		Submenu 2.1
95			Submenu 2.1.0
96		Submenu 2.2
97			Submenu 2.2.0
98			Submenu 2.2.1
99				Submenu 2.2.1.0
100				Submenu 2.2.1.1
101				Submenu 2.2.1.2
102			Submenu 2.2.2
103	Submenu 3
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22642
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Substitute Limit?

Post by jsmorley »

I believe what brian is talking about is the number of (captures) you can have in a single regular expression. This is true of both RegExpSubstitute and WebParser. The limit of indexed captures is 99.
User avatar
Yincognito
Rainmeter Sage
Posts: 7583
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Substitute Limit?

Post by Yincognito »

jsmorley wrote: July 17th, 2020, 1:12 am I believe what brian is talking about is the number of (captures) you can have in a single regular expression. This is true of both RegExpSubstitute and WebParser. The limit of indexed captures is 99.
I see. That's good news, it means one can have more pairs in the Substitute. Not that they were absolutely needed, but just trying to make the solution as broad as possible, and just 100 pairs was a bit low for hypothetical larger menus (in my scenario). Thanks for the answers - much appreciated. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7583
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Substitute Limit?

Post by Yincognito »

Brian wrote: July 16th, 2020, 10:45 pm I think it is more limited to the number of characters in the entire section. I believe a section's size can be no more than 32767 characters. That includes each key=value pair and newlines.
Just for reference, I just re-discovered this the hard way, trying to (RegExp) Substitute an input string longer than 32767 characters in a String measure for the past two days - so the 32767 char size limit is just for the "value", I don't think the "key" or the "section" play a part in this (though the "key" size might be limited to 32767 chars individually as well, didn't test that one). The effect is that the string starts over from 0 chars upwards, after surpassing 32767 chars, similar to how overflow numbers react.

It would be interesting to know how to avoid the issue when one doesn't know or can't control the size of such a "value" or string, since it's not even entirely "seen" by Rainmeter in order to break it in smaller parts... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth