GREP find and replace for language direction
Learn / Forums / General InDesign Topics / GREP find and replace for language direction
Tagged: direction, find and replace, GREP, hebrew
- This topic has 14 replies, 5 voices, and was last updated 9 years, 5 months ago by Jay-Art Sadjail.
-
AuthorPosts
-
-
September 21, 2014 at 1:30 am #70688Rivkah LewisMember
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 WordSome 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!
-
September 21, 2014 at 1:31 am #70689Rivkah LewisMember
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.
-
September 29, 2014 at 10:48 am #70805Rivkah LewisMember
Anyone….?
Doing this manually and it is soooo time consuming. -
September 29, 2014 at 1:00 pm #70806Aaron TroiaParticipant
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 -
September 29, 2014 at 1:08 pm #70807Rivkah LewisMember
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. -
September 29, 2014 at 1:59 pm #70809Aaron TroiaParticipant
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 -
September 30, 2014 at 12:25 am #70814Rivkah LewisMember
It works for some of them, but not all of them.
Phrases that have ellipses or parenthesis are not working.Thanks!
-
October 1, 2014 at 7:43 am #70829Chris ThompsonMember
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.
-
October 1, 2014 at 11:12 pm #70847Rivkah LewisMember
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. -
October 1, 2014 at 11:13 pm #70848Rivkah LewisMember
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 :) -
October 2, 2014 at 12:24 am #70849Chris ThompsonMember
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. -
October 2, 2014 at 1:26 am #70850Rivkah LewisMember
That’s an interesting idea.
I’m going to try it and a bit and let you know what happens.Cheers.
-
October 30, 2014 at 5:08 am #71305Jay-Art SadjailMember
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
-
October 30, 2014 at 5:35 am #71306David BlatnerKeymaster
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
-
October 30, 2014 at 7:08 pm #71337Jay-Art SadjailMember
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?…
-
-
AuthorPosts
- You must be logged in to reply to this topic.