Skip navigation
Currently Being Moderated

Help with Find/Change and wildcards

Aug 8, 2012 6:26 PM

Tags: #cs5 #find/change

I have indesign CS5 and I'm working on a document that has math examples throughout such as 9-1=8. The proofreader said we need to change it to have a space between each digit and math symbol to be 9 - 1 = 8. How can I do this? When I go to Find/Change I have the option of wildcards in the Find, but not in the Replace.

 

Also the dash in these equations need to be changed to en dashes. How can I tell indesign that anytime is sees such an equation the dash needs to be changed? I don't want to just change all dashes as I have many dashes that need to stay.

 
Replies
  • Currently Being Moderated
    Aug 8, 2012 8:19 PM   in reply to Y Rose

    try it on greep

     

    Search: (\d+)\-(\d+)\=(\d+)

    Change: $1 - $2 = $3

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 3:54 AM   in reply to Y Rose

    I do it in two steps, first changing the hyphens to en-dashes:

     

    Find (?<=\d)-(?=\d) which finds any hypen between two digits

    Replace ~= which is the en-dash

     

     

    Then use a class to hold the math symbols:

     

    Find (\d|\))([\+\*/~==])(\d|\()   (this adds open and close parentheses to the search before or after a symbol -- if your equations don't use parentheses you can eliminate the |\( and |\) from the first and last search groups)

    Replace $1 $2 $3  (there's a space between the terms there).

     

    This does not include radicals, or advanced math symbols in the search, so if your equations use those, you need to add them, and it doesn't put spaces between digits and parentheses.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 4:49 AM   in reply to Peter Spier

    Forgot to mention that the first query that changes the hypens to en-dashes will change them everywhere they appear between two digits, so you run the risk of changing things besides your equatuions, like some date or phone number formats, unless you restrict the search scope.

     

    Also, there is no provision for negative numbers in any of what I posted.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 8:55 AM   in reply to Y Rose

    so what are you doing for 3+4=7 or 9*5=45?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 9:57 AM   in reply to Y Rose

    Looks more complex that it is, really. You can just copy the query out of the forum and paste it into the dialog, and Jongware did a wonderful "what the grep" script http://forums.adobe.com/message/2698510

     
    |
    Mark as:

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