Copy link to clipboard
Copied
I am trying to work out a way of using a multiple search in GREP for putting an overhanging character (ie: ), p, %) in a table cell. I have managed to succeed individually, using GREP along with character and paragraph styles. I have tried to search for all 3 of the above in a multiple search, but it seems to clash somewhere. The GREP search for individual characters is thus:
FIND: \)
CHANGE TO: )~h~j#
The "hash" has a style given to it, which includes kerning back, to achieve the overhang. So in the table cell, you would have:
1,100
(2,200)
3,300
This would apply to each search.
Copy link to clipboard
Copied
Probably all you need to do is define your overhanging characters as a character class by putting them in square brackets: [%)p] -- no need to escape characters in character classes, so ")" is fine here, no need for "\)".
Peter
Copy link to clipboard
Copied
Thanks Peter
Have only just got to look at your reply
I have tried what you have suggested, searching for ) and replacing with [)]. Initially, the search couldn't recognise the parenthesis. So I put it in quotes ")". This time it did see the search. The end result was a parenthesis with brackets either side (as keyed). Being new to the GREP coding, am I keying in the correct characters? Remember, I am searching this within a cell table and need the ) to overhang the cell. Which characters do I need to put into the search?
I await your reply
Many thanks
Steve
Copy link to clipboard
Copied
Steve,
I meant this:
Find what: [%)p]
Change to: )~h~j#
Placing characters in brackets creates a character class -- [%)p] stands for "find % and ) and p".
Peter
Copy link to clipboard
Copied
Thanks Peter, thats great.
Now, what would I have to insert into the replace panel, if I wanted to do a multiple search. By this I mean searching for the ) and % and p – and then replacing them with the relevant codes all in one search. Would InDesign be able to differentiate between the 'find' characters and replace them with the relevant replacements. So in my search it would be FIND – and then REPLACE – )hj# %hj# phj#
is this possible?
Many thanks
Steve
Copy link to clipboard
Copied
Find: [%)p]
Replace: $0~h~j#
@+
Marc
Copy link to clipboard
Copied
Thanks Marc
That seems to have done the trick. In conjunction with the individual styles I have made, the overhang works great. Do you know any more about producing an overhang without various styles. By this I mean one style for the ), one for % and one for p. Also, there is a style for the hash. I have tried incorporating all of these styles into one, but it doesn't work.
Regards
Steve
Copy link to clipboard
Copied
stevieun wrote:
(...)
Do you know any more about producing an overhang without various styles. By this I mean one style for the ), one for % and one for p. Also, there is a style for the hash. I have tried incorporating all of these styles into one, but it doesn't work.
(...)
GREP-Styles could be a promising path:
* First, create a character style for each character you need to customize: RIGHT_PARENTHESIS, PERCENT_SIGN . . .
* Then, in your main paragraph style, add the corresponding GREP-Style rules, one to apply the RIGHT_PARENTHESIS style to the pattern \), another for % , et c.
@+
Marc
Find more inspiration, events, and resources on the new Adobe Community
Explore Now