Skip to main content
Inspiring
March 27, 2013
Question

GREP to Find Numbers at End of Story

  • March 27, 2013
  • 1 reply
  • 1944 views

I want use GREP to do a find to locate any six digit number or just the numeral zero at the end of each story in my InDesign 4 documents.

So far, I have ben able io identify six digit numbers by searching for the following \d{6} But when I add the end of story location marker,  \z\d{6}, no results are returned.

What do I need to do to:

1. get the expression to search for the number at the end of the story

2. amend my expression so that it finds either a six digit number or the numeral zero

Any help on this would be appreciated

This topic has been closed for replies.

1 reply

Community Expert
March 27, 2013

@kmc27 – since \Z marks the end of the story and your digits go before that end, you should find your 6 digits with:

\d{6}\Z

Uwe

Community Expert
March 27, 2013

@kmc27 – and for the second question, use the following GREP:

(\d{6}\Z)|(0\Z)

The pipe between the two expressions mean the logical OR.

But is that really a scripting question?

Uwe

kmc27Author
Inspiring
March 27, 2013

Thanks for the help. Before I posted my question, I had tried the code you suggested in your first post, and it never returned any results for me. Maybe I am defining the location, "end of story" incorrectly.

In the InDesign document here isn't the six digit number in the first example and the zero in the second example at the end of the story? Wouldn't \z find these numbers?