Copy link to clipboard
Copied
((^\s)*)(abc)
I originally thought that with one set of brackets, abc should be $2.
But in fact, abc is $3
But the expression:
([,,\h]*)(abc)
Here abc is $2.
You have 3 capture groups. (ABC) is the third.
if you're not sure, just count the "(" from the left ... 1, 2, 3!
P.S. in your second example you have 2 capture groups and (abc) is the second.
Well, yes, once for each found instance.
Try this experiment, using text frame with "abcdefghijklmnopqrstuvwxyz".
1. findWhat:
(abc)(def(ghi)jkl)(mno)
2. changeTo:
0 = $0\r1 = $1\r2 = $2\r3= $3\r4 = $4\r\rnot captured =
So start with this:
Then perform the find/change on the text. You will see this:
We have split up the capture groups and shown them with the index. Maybe it will help you to look carefully at what is going on here, especially the nested group that captures "ghi".
- Ma
...Copy link to clipboard
Copied
You have 3 capture groups. (ABC) is the third.
if you're not sure, just count the "(" from the left ... 1, 2, 3!
P.S. in your second example you have 2 capture groups and (abc) is the second.
Copy link to clipboard
Copied
One bracket captured once?
Copy link to clipboard
Copied
Well, yes, once for each found instance.
Try this experiment, using text frame with "abcdefghijklmnopqrstuvwxyz".
1. findWhat:
(abc)(def(ghi)jkl)(mno)
2. changeTo:
0 = $0\r1 = $1\r2 = $2\r3= $3\r4 = $4\r\rnot captured =
So start with this:
Then perform the find/change on the text. You will see this:
We have split up the capture groups and shown them with the index. Maybe it will help you to look carefully at what is going on here, especially the nested group that captures "ghi".
- Mark
Copy link to clipboard
Copied
There's still this kind of play.
Worship.
Copy link to clipboard
Copied
Count the brackets () 😉
Find more inspiration, events, and resources on the new Adobe Community
Explore Now