GREP find and replace for language direction

Learn / Forums / General InDesign Topics / GREP find and replace for language direction

Viewing 14 reply threads
  • Author
    Posts
    • #70688
      Rivkah Lewis
      Member

      I am designing a book to teach English speakers Hebrew.
      The back has a dictionary of all the words in the book. The style of the dictionary right now is
      English Word \ Transliterated Hebrew Word \ Hebrew Word and then the opposite in the next section:
      Hebrew Word \ Transliterated Word \ English Word

      Some of the “words” are actually phrases. Right now, the punctuation is coming out on the wrong side.
      Ex: Be quiet! \ Sheket! \ ??????!
      Instead of: Be quiet! \ Sheket! \ !??????

      I have InTool’s World Ready plugin.
      So I made a character style to apply to the Hebrew with the correct text direction and then I tried a GREP find and replace with the following code:
      [^.,;:?!\d a-z|A-Z]+
      which is supposed to find all non-English characters. It gets all dashes too, but that’s not a problem.
      When I select an entire phrase with punctuation and apply my character style, it works perfectly. But the GREP is finding each individual word and not changing the punctuation placing.

      What am I doing wrong? How can I get it to select all non-English characters until it sees an English character (and thereby get the whole phrase) as opposed to taking each one individually and thereby accomplishing nothing?

      Thanks!

    • #70689
      Rivkah Lewis
      Member

      I see now that it posted that the Hebrew is coming up as question marks, but you can see where the “!” is in any case in the 2 examples – one is to the right of the question marks and one is to the left.

    • #70805
      Rivkah Lewis
      Member

      Anyone….?
      Doing this manually and it is soooo time consuming.

    • #70806
      Aaron Troia
      Participant

      Now I haven’t tried this in InDesign, but thought I would see if it would help, you might be able to do a search for Hebrew Unicode characters, it looks like the range is 0590–05FF, so you could try doing a search for [\x{0590}-\x{05FF}]+ to find only the Hebrew characters with the punctuation at the end in a separate group, then switching the groups in your change so the punctuation comes before the Hebrew Characters.

      Find: ([\x{0590}-\x{05FF}]+)([,.?!])
      Change To: $2$1

    • #70807
      Rivkah Lewis
      Member

      Thanks for taking the time to respond.
      The code does find the characters and the punctuation and does change them, the problem is it does the same thing as above – changes just that word and doesn’t work on the phrase, so the punctuation ends up somewhere in the middle of the phrase.

    • #70809
      Aaron Troia
      Participant

      oh ok, I see, that does make it harder when you have phrases, I see now why you had the space in your character range. Now I tried this with Latin and it seems to have worked, all i did was introduce a space like you had into the character range so that it would keep going until it hit punctuation.

      Find: ([\x{0590}-\x{05FF} ]+)([.,;:?!])
      Change: $2$1

    • #70814
      Rivkah Lewis
      Member

      It works for some of them, but not all of them.
      Phrases that have ellipses or parenthesis are not working.

      Thanks!

    • #70829

      How about a different solution:
      1. use a table, 3 columns, English / transliteration / Hebrew
      2. select column 3 and apply a suitable RTL character style.

      Chris.

    • #70847
      Rivkah Lewis
      Member

      Hi Chris,

      Good idea – I originally had it set up like that. But it was taking up too much room and was giving me grief with long phrases. I couldn’t have the format as I wrote above: Word \ Transliteration \ Hebrew word.
      It would come out like
      Word Transliteration Hebrew Word
      Longer Word Longer Transliteration Longer Hebrew Word
      with odd spacing. This would have been ok has I had one table per page, but the dictionary is in 2 columns and small – it was taking up too much room and its really like a reference at the back of the book.

    • #70848
      Rivkah Lewis
      Member

      My spacing didn’t come out accurately in the post.
      Imagine that the columns are lined up on my fake table, causing big white spaces :)

    • #70849

      OK, using my imagination…

      What if you:
      1. set up all of the the dictionary as a temporary table
      2. apply the RTL to the relevant column as above
      3. then convert the table back to text (using a space-slash-space for a column separator and carriage return for row separator)
      4. and flow it into your 2-column pages

      – wouldn’t it keep the RTL settings on the former “Hebrew column”?

      regards,
      Chris.

    • #70850
      Rivkah Lewis
      Member

      That’s an interesting idea.
      I’m going to try it and a bit and let you know what happens.

      Cheers.

    • #71305

      Hi! I’m designing a yearbook and my problem is… is it possible to use find change in moving a word to another line? here the sample of the text i want to change the location

      Name
      nick name
      Email address
      Birthday
      Address
      Parent name mother
      Parent name father
      “Be of good courage and God shall strengthen your heart.”
      Honor(s):
      1st Place, Exhibit
      3rd Place, Cheerdance Competition
      Affiliation(s):
      Member, Association of Early Childhood Education Students
      Member, Senior Students’ Organization
      Member, United Future Educators
      Member, Youth for Christ
      Scholar, Garcia
      Love your duty, no matter how many hardships you face and no matter how uncertain the future that awaits. Have faith! Surely God will take you there.

      then i want to transfer the location of the nickname and the saying with qoute at the end of paragraph.. in order to match my design and my paragraph styles

    • #71306
      David Blatner
      Keymaster

      Jay-Art, you can. Let’s say you have 7 paragraphs and you want to move the 3rd paragraph to the end.
      First, search for
      (.+\r)(.+\r)(.+\r)(.+\r)(.+\r)(.+\r)(.+\r)
      and then replace with
      $1$2$4$5$6$7$3

    • #71337

      Thank you sir David. I was so happy coz learning in indesign I’m a fun of yours. I’ve tried it and it works to some data but on other data it messes my work since my paragraphs are not consistent. is there other way?…

Viewing 14 reply threads
  • You must be logged in to reply to this topic.
>