Thursday, October 18, 2012

Grep Pattern to Apply Character Style to Any Email Address

Usually every or almost every document contains email address. Here is quick tip and GREP pattern (or code) to copy paste it in InDesign which will match any email address and apply specified Character Style. Pattern is following, just copy it from this page:



[-\u\l\d._]+@[-\u\l\d_]+\.[\u\l\d]{2,5}(\.[\u\l]{2,5})?



for more details and explanation read from this link with free chapter from Adobe InDesign CS4 Styles: How to Create Better, Faster Text and Layouts. There is also interesting discussion on InDesign Secrets about GREP pattern to match email and web addresses.



How to use GREP pattern

To use this pattern create new Paragraph Style in InDesign (name it: with GREP for example). Click on GREP Style to see options for this tab. Click New GREP Style button. Next step is to click on the right side of To Text: and to paste code (replace or delete default \d+).




Create New GREP Style in Adobe InDesign
Create New GREP Style in Adobe InDesign


Choose Character Style to apply to matching pattern

To apply Character Style to email address you need to specify which style you want to apply to the text that match GREP instruction (email address in this case). Click on [None] next to Apply Style: then click triangle on the right side to open pop-up window from which you can select Character Style to be applied or to create new one by clicking on New Character Style...




Choose Character Style to apply to matching pattern
Choose Character Style to apply to matching pattern


Benefit of GREP Style

If you are wondering why to take this action here is explanation: Character Style specified for GREP Style will be automatically applied to any email address within paragraph text without you to take any additional action. Note: you must apply Paragraph Style within which is GREP Style (with GREP).




Paragraph Style with GREP applied
Paragraph Style with GREP applied


Reference:

Quick Tip: Automatic Formatting using GREP Styles in Adobe InDesign



Product used in this tutorial: Adobe InDesign CS6




No comments:

Post a Comment