It is currently June 30th, 2024, 11:05 pm
Substitute Limit?
-
- Rainmeter Sage
- Posts: 7583
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Substitute Limit?
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?
-
- Developer
- Posts: 2701
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: Substitute Limit?
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
Also, I believe there is a hard limit of 100 for regexp replacements.
-Brian
-
- Developer
- Posts: 22642
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Substitute Limit?
Just a nitpick, but isn't it 99?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
-
- Developer
- Posts: 2701
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
-
- Rainmeter Sage
- Posts: 7583
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Substitute Limit?
Hmm...that's interesting for sure. Good to know - thanks.
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...
![Shocked O.O](./images/smilies/ai.gif)
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 :cheer:](./images/smilies/bi.gif)
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
-
- Developer
- Posts: 22642
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Substitute Limit?
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.
-
- Rainmeter Sage
- Posts: 7583
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Substitute Limit?
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.
![Wink ;-)](./images/smilies/innuendo.gif)
-
- Rainmeter Sage
- Posts: 7583
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Substitute Limit?
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...
![Confused :???:](./images/smilies/bw.gif)