Skip to main content
James Gifford—NitroPress
Legend
July 19, 2024
Answered

ID GREP question: non/marking subexpressions?

  • July 19, 2024
  • 3 replies
  • 704 views

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.

This topic has been closed for replies.
Correct answer Peter Kahrel

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.

3 replies

Mike Witherell
Community Expert
Community Expert
July 19, 2024

Mwen pa ka palé Patwa!

Mike Witherell
James Gifford—NitroPress
Legend
July 19, 2024

😄

 

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.

Mike Witherell
Community Expert
Community Expert
July 19, 2024
James Gifford—NitroPress
Legend
July 19, 2024

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

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
July 19, 2024

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.

James Gifford—NitroPress
Legend
July 19, 2024

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.