6 Replies Latest reply on Jun 21, 2016 5:54 AM by RuthK

    Using GREP to apply a style to Hebrew words

    RuthK Level 1

      InDesign CC

      I use GREP styling in paragraph style definitions to apply a character style to Hebrew words using this expression:

      [\x{0590}-\x{05FF}]

      This is a bit brutal because it only applies it to the actual Hebrew characters, but any punctuation within the Hebrew gets missed.

      I don’t understand GREP much, anything I use has been cobbled together from the internet.

      Is there a grep expression I can use which will also style any punctuation surrounded by or joined to Hebrew letters? For example, quotemarks, apostrophes and colons?

      Thanks in advance

      Ruth

        • 1. Re: Using GREP to apply a style to Hebrew words
          [Jongware] Most Valuable Participant

          The trick is to add punctuation to your expression, but only if it's preceded of followed by Hebrew – if not, your Hebrew style would get applied to 'just punctuation' as well.

           

          Here is the GREP I've used so far:

           

          ([\x{0590}-\x{05ff}]+( |\p{punct})*)+

           

          The first part is the same as yours, matching Hebrew characters only. Then it looks for either a space or "any punctuation"; InDesign's GREP supports the extended code "\p{punct}" for that. Since the punctuation is optional and there can be more than one of them, I followed it by a *. Finally, the parentheses around the entire thing and the + at the end makes sure it grabs as long a consecutive string as it can.

          2 people found this helpful
          • 2. Re: Using GREP to apply a style to Hebrew words
            RuthK Level 1

            Thanks so much - unfortunately this also grabs the adjoining spaces - is there a way to exclude spaces? Or is there a way to specify specific punctuation marks?

             

            I don't understand it enough to modify it myself.

            • 3. Re: Using GREP to apply a style to Hebrew words
              Peter Spier Most Valuable Participant (Moderator)

              Jongware, what about leading quotation marks?

              • 4. Re: Using GREP to apply a style to Hebrew words
                RuthK Level 1

                Would it help if I uploaded some samples in the form of images?

                • 5. Re: Using GREP to apply a style to Hebrew words
                  TᴀW Adobe Community Professional & MVP

                  I do a lot of typesetting of text that includes Hebrew. I've rarely needed to resort to GREP.

                   

                  Most of the texts are originally prepared by the authors in Word.

                   

                  Very luckily, Word, by default, has this feature whereby when the user switches keyboard (to type in Hebrew) Word changes the language property of that text. And, the good news is that this language attribute gets carried over into InDesign.

                   

                  So, what this means is that in practice it is almost always possible to search, in InDesign, for any text that has the Hebrew language applied to it, and then apply an appropriate character style. This avoids having to do awkward GREP searches (because you're always going to run into difficulties with GREP because of spaces and punctuation, and to be on the safe side would always need to do one change at a time just to see that all is well).

                   

                  Your workflow may be different, but if it is a question of setting texts that have been created in Word, this system usually works pretty well.

                   

                  Ariel

                  • 6. Re: Using GREP to apply a style to Hebrew words
                    RuthK Level 1

                    Thank you - for the most part I don't have too much trouble, I use grep to apply the hebrew to hebrew words and not much formatting needed after. But occasionally there are bits with brackets and apostrophes and it doesn't seem to cope with the correct order of the characters, I expect I will always have to work on those parts manually.

                     

                    But if I can catch Hebrew acronyms which take the form of letter(s), quotation marks, letter, there will be less manual processing.

                     

                    R