Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

GREP Find/replace multiple items

Return to Member Forum

  • Author
    Posts
    • #83798
      Matt Isaac
      Participant

      I am working in InDesign on a PC.. I need to update files that were previously created on a mac. The previous editor used Helvetica Fractions as her type face of choice when formatting fractions, though PC does not have this font available. I know that 1=z, 2=x, 3=c, etc. when converting to Arial and each numerator appears as a capital letter and each denominator appears as lowercase, also all forward slashes are converted to backslashes. Currently I use the GREP expressions:

      To change the letters to numbers:
      Find: [Z|z] Find Format: Helvetica fractions Change to: 1. (at this point i don’t change the format to Arial, that comes later for me)

      To change the formatting and slashes:
      Find: (\d+)\(\d+) Find Format: Helvetica fractions Change to: $1/$2 Change Format to: Arial regular.
      I run this GREP for each individual fraction and while it has each fraction highlighted i run a script to format the selected fraction with the numerator being superscript and denominator being subscript.

      What I want to know is this…
      Is there a way to combine all of the GREP expressions into one and have something that will find Z\v , B\. , and X\c to make them 1/4, 5/9, and 2,3 respectively. or will I need to have a different expression for each section as I have been doing?

    • #83801
      Matt Isaac
      Participant

      I noticed i left out a backslash in my changing formatting and slashes find expression.. Find: (\d+)\(\d+) should be (\d+)(\d+). Also i would use the first expressions for each number 0-9 before moving to the next expressions. so total i am using 11 GREP expressions and 1 script to accomplish this.

    • #83808
      Ari Singer
      Member

      I doubt that you can do it in one expression, but you should use the FindChangeByList script to automate it. You can even finish up the script with two GREP expressions to automatically find any digits preceding a slash and apply superscript and then find any digits following a slash and apply subscript (But it would be better to use an OpenType font that provides ‘real’ fractions).

    • #83901
      Matt Isaac
      Participant

      I was hoping i could use something like find: ([Z|z]?)([X|x]?)([C|c]?)etc. Then somehow change $1 to 1 $2 to 2… etc.

      • #83904
        Ari Singer
        Member

        Unfortunately, GREP does not work this way.

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads