Copy link to clipboard
Copied
Okay, since we're having so much fun with GREP this week —
Can anyone from @Peter Kahrel on down explain what "Marking Subexpression" — ( ) — and "Non-Marking Subexpression" – (?: ) — are/do? I can't find a word about them in any search of the Adobe help, or Google, or any general GREP reference.
The first, as just "subexpression," is somewhere in the "duh" category, as grouping elements with parentheses is a basic GREP element. The second makes no sense, really. And giving both drop-down call elements seems... pointless.
These look very much like ancient, outdated elements that have persisted from sheer inertia, the kind of stuff that drives me crazy when I update ancient holy texts in various fields.
A marking subexpression is one that InDesign creates a referent for, so that you can later refer to it using $1 (to $9).
There are occasions where you just want to group a subexpression but you don't need a reference. In that case you do a non-marking subexpression (?: . . .). Creating a reference is (relatively) expensive, so using a non-marking subexpression whenever you can makes the Grep expression more efficient -- at the cost of readability,.
So in fact you can happily live without eve
...Copy link to clipboard
Copied
A marking subexpression is one that InDesign creates a referent for, so that you can later refer to it using $1 (to $9).
There are occasions where you just want to group a subexpression but you don't need a reference. In that case you do a non-marking subexpression (?: . . .). Creating a reference is (relatively) expensive, so using a non-marking subexpression whenever you can makes the Grep expression more efficient -- at the cost of readability,.
So in fact you can happily live without ever using any non-marking subexpressions. It's just a device to make Grep more efficient. Mind you, this goes back a long time when processors were slower and memory much smaller, and with modern computers most of the time you'll probably not see much difference -- if any.
P.
Copy link to clipboard
Copied
Thanks!
One of the aggravating things about topics like this (mostly, but not entirely in programming) is so much legacy baggage — it never quite becomes outdated enough to ignore, but it's not of much use to some majority of users.
Copy link to clipboard
Copied
This was pretty clearly described:
https://stackoverflow.com/questions/36525579/when-do-we-need-non-capturing-groups
Copy link to clipboard
Copied
Well, yes, but it doesn't use any correlated search phrase. You sort of have to know what you're searching for to expand the search to find it.
I could not get from "marking subexpression" to any useful topic. So on top of everything else, we have different tribes' patois to cope with. 🙂
Copy link to clipboard
Copied
Mwen pa ka palé Patwa!
Copy link to clipboard
Copied
😄
I've just sat in too many meetings with programmer/developers who came up different ladders, subtly or not-so-subtly insisting on their (tribe's) terms and phrases. The migraine ones were where some hard case would ask, "What's a _____?" every single time the other term was used.
I don't do code meetings any more.