Skip navigation
1John5vs7
Currently Being Moderated

How to search for a variety of characters

Jan 13, 2014 12:52 PM

Tags: #grep_characters

I am working on a document wherein a script I ran has applied differential results to page indicators. I am trying to ensure that I have easy accessibility to indexing in an e-book format, and so I am doing the following:

 

1.) Inserting notes at physical page breaks in the print layout in InDesign

2.) making those notes visible

3.) applying the "page" style to them, which I have set to display hidden in my CSS but will allow me to insert anchor points for a hyperlink index

 

The problem is the note shows up differentially. Some say:

 

{~?~PG: @##@} while others show {~?~PG: %##%} where ## represents some page number. The @##@ received the page style properly, but not the %#%. What would be the GREP approach to searching for every instance of {~?~PG: %##%} and applying the page style to it?

 

I know how to make sure that the page style is applied. I know that I'd use (\d+) for the numbers. I don't know hwo to represent the brackets, tildes, question marks, or other characters. Is there a good reference for this somewhere or perhaps a tutorial? I hate to bug the forum community with it. I just don't know where to go to get the info I need.

 

 

Edit: To be clear, I'm trying to search for the string

{~?~PG: %##%}

 

All of the characters in the string are the same each time, but the numbers are sequentially higher and higher. There are hundreds of these in my document, so replacing each manually is taking a long time. Thanks for any feedback.

 

Edit #2: After a lot of trial and error, I nailed it. This worked for me:

\{(.+)\%(\d+)\%.

 

I left the "change to" blank and in the big Change Format window, I added character style "page", though of course this is going to be different for you depending on how you have the name of that style set up in your CSS file if you're making an e-book too. : )

 

Message was edited by: 1John5vs7

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points