Copy link to clipboard
Copied
Hi folks
A client has passed me a manuscript where all text to be italicised is enclosed in $ signs e.g. $italicise this$. This seems like a perfect job for GREP, but I cannot get it working consistently.
Text between $ signs may include any other text i.e. letters, digits, whitespace\newline, punctuation
Goal is to find each instance, italicise the text, and remove the $ signs.
My current GREP query is shown below (see screenshot for full search), but it misses many instances:
Find: (\$)(.+)(\$)
Replace: $2 (Change format to “Italic” character style)
Any help appreciated!
Thanks
Richard
Copy link to clipboard
Copied
Hi Richard,
isolate some of the not found instances and make a document available we could test.
One page with some text frames should be enough…
Thanks,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Thanks for your reply - unfortunately the text is confidential so I won't be able to offer a sample, but thanks in any case!
Copy link to clipboard
Copied
I'm surprised you say it's missing instances rather than including too much.
I think I would use Find: (\$([^$\r]+)\$) and change to $2 with your italic formatting.
The [^$\r] is a negative class that finds any character not a dollar sign or paragraph return. This prevents a match that crossses a paragraph boundary. It might not be what you want, however, as you mentioned a newline, but I'm thinking that is really a forced line break rather than a paragraph break. If you need to italicize multiple entire paragraphs some of which have no $ at the stasrt or end, remove the \r. Note that this could fail miserably if there are any cases where there is text with only one dollar sign, like a price.
I'd test this out on a copy of the file....
Copy link to clipboard
Copied
Thanks for your replies - I'll give that a go.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now