5 Cool Things You Can Do with GREP Styles
I love GREP Styles in CS4. I’ve said it before: It’s probably my favorite new feature, and although it’s small, I think it makes the upgrade very worthwhile. But what are they, how do you make them, and what can you do with them?
A GREP Style is a way to apply a character style to some text inside a paragraph, based on a GREP pattern. GREP, as we’ve discussed, is a way to describe a text pattern using codes. For example, you can write “all the words that start with a and end with e” with the code \<a\S+?e\>
You can use GREP in the Find/Change dialog box, but only manually — that is, you have to actually do a search and replace each time you want to apply the formatting. GREP Styles don’t change text at all; they only apply formatting. But there are many things you can do with just that.
To apply a GREP Style to a pararaph, you probably want to edit your paragraph style definition. (You can apply a GREP Style to a single paragraph as local formatting by placing the cursor in the paragraph and choosing GREP Styles from the Control panel menu. But I find that in general it’s just more useful using GREP Styles inside a paragraph style.)
To make a new GREP style, click the New GREP Style button:

To apply a character style, click once on Apply Style and it turns into a character style. Then you can choose a style you’ve already made or choose New Character Style if you haven’t made one yet. (That’s another little feature I love in CS4.)
Type the GREP code in the To Text field. For example, the default GREP code \d+ means “one or more digits in a row.”
I encourage you to turn on the Preview checkbox to see how (or if) it works before clicking OK.
Five Cool Things You Can Do with GREP Styles
Okay, enough with the “how.” Now what about “what”? Bob Levine already posted about one way to use them here. Here are 5 more ways I like using GREP Styles. Please feel free to comment below with other ways you’re using this cool feature.
1. Oldstyle Numerals. Apply a character style that applies the OpenType Oldstyle Proportional figure style to all digits in a paragraph.

2. No Break words and phrases. I’m tired of setting individual words to “No Break” or changing dictionaries to instruct InDesign not to break words. If I don’t want to break “InDesign” on to two lines, I’ll just apply a no-break character style to the GREP code “InDesign” (that’s pretty simple grep, eh? Just type the word!)
3. Change Width of Em Dash. In some fonts, the em dash is just too wide for my tastes. No problem. Make a character style with a 75% (or whatever) horizontal scale. Then apply it to the em dash character. Don’t know how to type an em dash code? No problem. Just click the
icon to the right of the To Text field. That shows you all kinds of cool codes for things.
4. Make OpenType Fractions. Jamie McKeee reviewed and explained the excellent Fraction script in the recent issue of InDesign Magazine. I added a little sidebar to that review before it went “to press” that explained that if you are using OpenType fonts that include the Fraction style, you can apply them with a GREP Style. Apply a “Fractions” formatting character style to the code \d+/\d+ (which means “one or more digits, followed by a slash, followed by one or more digits.”) It won’t work if you have commas or decimals in the fractions, but it’s a good start! (Of course, you could make a GREP code to handle those situations, too…)
5. Make Characters Disappear. My colleague and co-author Olav Kvern just wrote me, saying, “You really don’t need to find/change typical typewriter text entry errors (double spaces after periods, etc.) anymore–just make a grep style that does it and make it part of your base paragraph style(s).” Wow. Good point! But how to make a character disappear when you can only apply formatting? Make a character style that applies the fill color of None, a tiny point size, and a horizontal scale of 1%. Boom, it’s “gone.”
Dang, I can’t stop at five. Here’s one more you might find useful:
6. Replace text with icons. What if you want some text to convert into a special character? For example, everywhere you type some normal text, you want it to change into a special icon in a particular font. Here’s the before and after:

I found the ornament/symbol/glyph I wanted could be typed with the number “4″ in Bodoni Ornaments. So then I made up a little easy-to-remember code that would never show up in normal text: “4z”. I then added two grep styles. The first one was 4(?=z) which means “look for the character 4 but only when it has the letter z immediately after it.” I applied my bodoni ornaments character style to that. The second grep style was (?<=4)z which is “find the letter z, but only when it has the number 4 before it.” To that, I applied my disappear character style.
What do you think? Can you think of other cool uses for this excellent feature?
For my money, GREP styles, IDML, and cross-references are the three best things about CS4.
Folks should check out the GREP resources page here.
I’m especially fond of Rorohiko’s GREPTutor. because it gives you instant feedback. You can paste or type some sample text, type in an expression, and instantly see what that expression matches in the sample text.
Let me add this also, for Dutch readers also on my blog:
http://fvdgeest-dtp.blogspot.com/
A text about pollution that has CO2 an H2O in it. The 2 has to be subscript and some baseline shift.
A characterstyle is made that has this baselineshift and subscript and is applied to the GREP styles:
(?<=CO)2
and
(?<=H)2(?=O)
The (?=O) part because also H2 and H2C is also in the text and this does not need the subscript!
Added a acronym GREP but this has to exclude the CO in the CO2 part:
\u\u+(?!\d)
(thanks to Harb from InTools for this one!)
One click on the paragraph style and all formatting for acronyms, CO2 and H2O is made.
For Dutch readers: this is an example of GREP from my book InDesign CS4 wich is released January 20th in the Netherlands. Ful colour, hard cover, 480 pages. See my blog for more information.
Wow, David, very cool GREP style tips here!
I especially liked “3. Change Width of Em Dash” — as them long ems have annoyed me often — but your whole piece is an inspiration to get creative with GREP styles.
On a Mac, anyway, you can type the actual em-dash character by using Opt+Shift+hyphen.
I use this GREP style to add space on each side of every em-dash:
Apply: Track75
To text: .~_
where Track75 applies 75 units of tracking. And the GREP means: any character followed by an em-dash.
Dave
>where Track75 applies 75 units of tracking. And the GREP means: any character followed by an em-dash.
In Dutch we have many things like:
blalala – in between – blalbla.
(space, en-dash, space)
So use tracking also on the en-dash followed by anay character (or in this case: space)
I’ve found grep styles really handy for automatically applying small caps. This one does it for things like 9am, 9pm or even 9km:
(?<=\d)[\l\u]m
This does it for a list of specified abbreviations:
\b(cd|dvd|mc|dc|gwcc|gaa|b&b|inec)
And we could use GREP styles to create syntax highlighters (useful to layout scripts or snippets).
Here’s a short example, using 7 rules in one paragraph style:
BEFORE applying the style
AFTER applying the style
The complete story (French):
http://marcautret.free.fr/geek/ikono/grepcolor/
Many People Have Requested A way To Use grep styles to use codes to format text and to have the codes disappear. Based On A Few Of The Previous Posts I Think it Is Fairly simple. First Create A grep Style That Includes Your Code, For Example I Use @01 Before The Text And @02 After The Text Which Is A grep Of @01.*?@02. Next Create A Disappearing Character Style Which Is .1 font Size, a 1% Horizontal Scale, a 1% Vertical Scale And Color Of The Paper. Next Make grep Style For Codes To Apply Disappearing Style. Make Sure Disappearing Style Is After Formatting Style. Boom you got what yot want.
GREP styles are great. But I never would use them to “correct” usual typo errors. Much better to use a script to achieve this. Or to use Autocorrect feature.
David,
You know I’m a HUGE fan of GREP. (I believe you and I were two of the first people to ask for GREP in InDesign many years ago.)
But I don’t understand your first point.
Why use GREP to apply Oldstyle to all digits in a paragraph?
Why not just set Oldstyle as one of the attributes in the paragraph style?
Sandee said: Why use GREP to apply Oldstyle to all digits in a paragraph?
That’s an easy one, Sandee…because we can!
Referring to my previous post:
Actually when I started I thought I would be able to add Hidden Text as a property of a character style and it was therefor necessary to place the hide grep style after the format grep style. But if you just use very small text for the code “@01″ markers then to indesign it’s still there and the order doesn’t really matter
To Sandee: I also got tricked by the first tip. “Because we can” makes no sense to me.
Later I understood where it can be used. Some typefaces still came in two flavours: oldstyle figures and small caps in one font, lining figures and regular alphabet in other. As I remember, fonts from DTL and Hoefler & Frere-Jones uses this. Of course, this is a situation to be changed with proper OT convertion/usage.
With GREP you can control this using a character style with the oldstyle/small caps font. So, the paragraph will actually uses two fonts, but in an automatic way, emulating the feature already usual to OT fonts.
@Igor: Thank you! Whew! I knew that there had been a reason that I used this on a project, but Sandee’s point was basically right. It wasn’t the OpenType fractions formatting I had applied; it was an Expert font (Utopia in this case). Trick saved!
Heh. The InDesignSecrets readers (and commenters) are the best, bar none!
Ive been playing arround with Grep and Grep-styles for a while and its a really cool feature.
David suggested I should share the file with you so here is my little christmas present to you… hope its a good one.. All of InDesign CS4 Keyboard shortcuts in a document that you can reformat as you like with ease.. if you´re bored this christmas that is…haha…
I copied the keyboard shortcuts from the Edit menu/ Keyboard shortcuts and went to Show sets. There you have all the secrets of Indesign shortcuts in a horrible unformated and unrapproachable text.
So I figured I could do this better by formating this file in one go by using Grep-styles, for easy updating (my file contains the Norwegian shortcuts, but dont worry). Its really easy to update to your language, just copy the shortcut commands set you want and paste it on page 1. …and VOILA…all the text formats with bolds, regulars, hidden text, italics, colours and so on…
Make sure you also check out the conditional text aswell as you can hide all the commands that are not defined. this is so cool… If you put your text in you need to do a grep search and apply the correct condition to apply this. Ive written a small “manual” on the right side of the page if needed.
The InDesign file can be downloaded from:
http://ejak.palografen.no/index.php/blog/mer/indesign_cs4_shortcuts/
Have a really nice christmas folks!
These are great! GREP styles ALMOST convinces me that I should upgrade.
But I disagree with “making test-editor mistakes disappear.”
First, why would you want to add a whole layer of complexity by shrinking down and no-filling these, when with a simple GREP or two you can get rid of them all. Makes a messy document.
Second — you hand that file to someone else, believe me you they’re not going to know WHAT the heck is going on. I had senior designers at my last assignment flummoxed by text variables — so I’m sure this would be equally — er — flummoxing.
I definately see your point Daniel, I too would be really nervous about handing files with grep-styles or even nested styles over to the average designer. I probably wouldnt, without making sure they actually can confirm to me that they know whats in store for them. I guess it has to be filed under the label “because we can”… and its more of a way of showing the power of a technology.
To be honest I know of designers that wont even use or understand the power of a simple stylesheets (which scares me…). It also seems to me that a lot of people with a background from Quark (sorry…me too) doesnt understand the difference between Character- and Paragraph-styles because theres so little difference in Quark which they were used to (and theyre not updating themselves). A whole set of time-, moneysaving and consistency possibilities is not available for them. If youre just producing one offs, like posters or flyers i wouldnt be too worried. But if youre in a heavy production environment lets say book- or magazine production, it would be plain madness not to use the posibilities that is spread across InDesign.
Still it doesnt mean that people with the knowledge shouldnt use it for less complicated tasks.
I had a project were the client would save aprox 97-99% time producing about 3000 adverts a year. This could be done by using the XML-features in InDesign. When you can tell and actually show someone that they can save time, errors and even earn more bucks they are much more inclined to learn the skills necessary (sadly the financial crisis hit the project…nobody seems to need houses these days…).
To be honest I spent days getting a proper understanding of GREP, and its power (yes, most people would say way too much). Most designers wont spend even 15 minutes with it because lets face it, its not very designer friendly (as a lot of other features in InDesign). I guess it comes down to easy math, if doing something manually takes less time than learning a skill it might be more sensible doing that, than spending hours learning. However if you can spend some time and use the skill over and over it might be worth looking into.
I also think there is a huge difference in technical needs between InDesign users or markets. For instance (without intending to step on anyones feet):
- Advertising / Design – less “highend” knowledge generally needed, as they are more focused on good ideas and one off production. (in the end result nobody will see if styles is being used or not). Time and cost of production is not necesary the most important issue, as investments in a good ideas are.
- Bookproduction – a lot of knowledge is needed, as they have repetition, and massive amounts of information that needs fast and accurate processing. Cost of working hours and timeconstraints is a big deal for them, therefore their interest in automation and everything that speeds up processes.
-Newspapers – needs extremely fast proccessing and have to be focused on a consistent information structure, many people works on the same product and we want it to appear the same from page to page, day to day. Everything that does things faster, more consistent is worth looking into, because of extreme time limitations.
I guess point being knowledge is bliss, when needed. And this always comes as the endresult of investing in learning. You just need to find out when to invest. Everything comes with a price.
Okay, I’m going to have to agree: I personally would not use grep styles to remove things like double spaces and other text errors. My point wasn’t to say you should do this, but simply to note that you can do it, and that you can make one or more characters disappear. The example could be useful, but I think the “disappear” example in #6 is better.
Using endnotes? Want an Opentype font to apply OpenType superior?
(?<=.)\d+
And make a characterstyle that has OpenType superior on.
Just found this post when I tried to figure out what GREP styles were. I’m a geek so I thought that they had added support for PCRE and MS flavors, or something like that. This is, obviously, much more useful.
I’d just like to add another very practical example (I hate to say it but many of the examples in the article seem a little contrived to me, although that isn’t a problem for showing possibilities).
GREP styles allow for a much more flexible equivalent of nested styles. I recently worked on a project where the first paragraphs of sections started with one of two options, depending on the author. They either began with something like “1.2.3. Here’s the section title. Now we go right into the text…” where I wanted OpenType all small caps applied to only the part shown in bold here. Other authors had no numbers and just titles (we didn’t mandate number as part of our format requirements since we have a mix of technical and non-technical authors), but those needed to be in small caps as well.
Nested Styles were a tremendous help but because there could be (theoretically) any number of digits (including zero) at the start of a section, it was impossible to define a single Nested Style that would work in all cases without using an End Nested Style Here character (which had to be inserted when we received files from authors, either manually or using a GREP search).
With this new feature, however, I can use the following simple pattern as a GREP style:
^([d.]+ )?.+?.
The ^ binds the pattern to the start of a paragraph and then has an optional unit of any number of digits and periods followed by the shortest number of any characters greater than one (.+? = one or more characters, but the shortest span that matches the pattern) followed by a period. (This pattern is a bit sloppy, but because it’s not used for search and replace, some things I would normally bother with I didn’t here, such as making the group in parenthesis into a grouping-only expression.)
This pattern is a generalizable one for all headings in this project and means I no longer have to manually apply the End Nested Style Here character. It’s also especially nice because I can round-trip content out to Word when I deal with authors who need to make substantive changes without worrying about the Nested Styles when I export to RTF and bring an edited file back in.
Hope this is useful to someone else.
I hate having to use nobreak to stop URLs from hyphenating. I’m going to try using this GREP style:
(?<=\.)[\l\u]+(?=\.)
This one competes for the ‘Shortest GREP Style Contest’…
Gill Sans is a beautiful typeface, but it’s hardly usable for text with numbers because of the odd shaped number 1 character. It looks the same as lower case l or uppercase i.
I found an alternative 1 in the Futura, whitch matches the Gill number shapes very well (with some fine tuning).
You can guess my solution: the GREP ‘pattern’ to look for was the character ‘1′ and ‘1′ the Character style to apply .
That’s short, huh?
I’ve always preferred Adobe’s awesome OPTICAL KERNING over the metrics. However, it screws up the monospacing of digits — for example, especially bad for lining up phone numbers on a business card (I work @ a printshop), or prices on a menu, etc.
Having just learned about GREP, I made a new character style called “monokern” (nothing more than the kerning style set to “metrics”) and applied it to “any digit” … VOILA! yay.
Great thread, all!
Here’s a stumper: C&C Galliard comes with ‘Alt’ versions which have the lovely swashy versions of some characters and ligatures. It’s easy enough to apply a GREP character style for an ampersand, but what about ligatures such as ’st’ or ‘ffl’? Is there any way to replace several found text characters with a single font character, without doing manual search-and-replace?
Aaron why wouldn’t you just turn on this option in the Paragraph Style or Character Style panel (OpenType Features > Discretionary Ligatures) for the text where you want to have those ligatures used?
Hi Anne-Marie,
This font is pre-OpenType and regrettably, I don’t think Carter & Cone have converted it yet. So as I said, the ligatures are in a separate ‘Alt’ font, each as an individual character.
It sure is a good candidate for OT treatment, and a beautiful typeface:
http://www.fontshop.com/fonts/downloads/carter_cone/itc_galliard_cc/
A quick note to Igor, above: the H&FJ fonts that come with old-style figures in a separate font now also come in OpenType, where everything is mercifully engineered so that OpenType-savvy applications (and designers!) can access everything under one roof. More info, here:
http://www.typography.com/ask/recentTopic.php?rtID=86
Is there a way to use GREP to only select the last couple of words in a paragraph? It’d be great if I could auto apply “No Break” to the last 2 words in every paragraph, thereby eliminating the problem of paragraphs ending with a single word on the last line!
@Teri: Excellent question! I might pull this one out into its own post at some point, but for now just use a grep style with a character style that applies No Break, and use this grep expression:
. \w+?[[:punct:]]*\s*$In other words: “Any character followed by a space followed by one or more word characters, possibly followed by one or more punctuation characters, possibly followed by one or more space characters… at the end of a paragraph.”
My favourite GREP style is to automatically highlight table and figure references in text, so I can find the nearest place to put’em.
* Make a character style called ‘highlite’ — one with a thick underline of about 10 pts, shifted upwards, and in a suitably bright color. Experiment for the best look for your text size.
* Add this GREP style to your ‘body text’ style. Remember that styles based on that style also inherit this GREP style — some careful handling of your styles means you only have to do this once!
(?i)(Figure|Table)\s\d+
and set its character style to ‘highlite’. If you see any abbrevs used for figures, just add them to the list, i.e.,
(?i)(Figure|Fig\.|Table)\s\d+
(Note the escape backslash before the period — it’s still GREP syntax, so this is needed for a literal period.)
Hey, all figures and tables are highlighted! To switch off the highlights, you don’t have to remove the GREP — simply turn Underline off in the highlite style.
Thank you so much for all the advices.
I would like to know if it is possible to define a GREPstyle for the «last line» of a paragraph?
thanks
What I really wanted was a grep to use with line styles to underline all the web link/addresses.
I got this far not really understanding grep that well:
[http://]*\w+[.](com|co.uk|org|net|gov|edu|info)[/\w+]*|[http://]*(www\.)\w+[.](com|co.uk|org|net|gov|edu|info)[/\w+]*|[http://]* (www\.)[\l\u\d_%-]+@[\l\u\d_%-]+[/\w+]*[.](com|co.uk|org|net|gov|edu|info),
Its a bit epic and still does not get everything.
Any ideas?
I have since created another query that gets web links, addresses and email addresses:
((http://www\.|www\.|http://)\w+(\.|/)(\w+(\.|/))*\w+)|[\l\u\d_%-]+@[\l\u\d_%-]+(\.|/)\w+(\.|/)\w*
It worked on every variation I could think of and it great for adding a style for example an underline to all web stuff.
Tom it couldn’t find email addresses or URLs that lack an http:// in my quick test.
Hi Anne-Marie, did you copy and paste both lines of the grep query?
I got some friends to test it and it worked fine for them.
We are on CS2 and 3 on xp 64bit PC’s.
Third times the charm…
((http://www.|www.|http://)w*(.|/|@)*(w*(.|/))*w*)|[lud_%-]+@[lud_%-]+(.|/)*w*(.|/)*w*
I had one too many one or more times and not enough zero or more times. All the examples I had tested on were big urls so my grep requiring multiple dot and forward slashes worked. I didn’t try really short ones so it wouldn’t pick up things like http://www.oneword or abc@def. The new zero or more times seem to have fixed it nicely though.
Sorry for insulting your intelligence with my previous comment…
Argggg! All the back slashes from my post were removed when I edited it so heres the grep with forward slashes:
((http://www\.|www\.|http://)\w*(\.|/|@)*(\w*(\.|/))*\w*)|[\l\u\d_%-]+@[\l\u\d_%-]+(\.|/)*\w*(\.|/)*\w*
@Tom
This seems to work for me. Short, simply, sweet and all encompassing
Web Address: [\l\u\d:/]+[.][\l\u\d_%-/]+
Email Address: [\l\u\d_%-.]+@[\l\u\d_%-.]+
In CS4: Stacked in Grep Styles section with email address appears 2nd in the list.
In CS3: I run the Web Address F/R first, followed by the Email Address F/R to clean it up.
It tags all the URLs and email addresses in the following text:
Here is a scenario where various web addresses are scattered randomly throughout a paragraph. Check out http://www.adobe.com/go/learn_id_grep (g1,2,3) for more details on the topic. With the new power of GREP searches one can save time manually formatting text within the document. Email me at cdandrea@loop.ca and I’ll send you, Mr. Jones, my saved queries. Check out http://en.wikipedia.org/wiki/Grep (g1,2) for it’s history in the UNIX world.
This is some text with a bunch of addresses in it.
Some variations on email addresses:
Contact me at john.doe@adobe.com
John’s email address: jdoe@adobe.com
Some variations of web addresses, also known as URLs:
Visit us at adobe.com (g1)
Make sure to check out http://adobe.com (g1)
Download the installer from http://www.adobe.com (g1,2,3)
Consult http://www.adobe.com (g1,2,3) for any help
Source for tutorials on CS3: adobe.com/designcenter/video_workshop/ (g1,3)
Everything you need can be found at http://adobe.com/designcenter/video_workshop/ (g1,3)
http://www.adobe.com/designcenter/video_workshop/ (g1,2,3) is a great resource to learn
If you need help check out http://www.adobe.com/designcenter/video_workshop/ (g1,2,3)
Grab all the old downloads from ftp://207.232.11.233 (g1,2,3)
The installer is buried here: ftp://207.232.11.233/adobefiles/indesign/ (g1,2,3)
Can GREP search for superscript numbers? I’d like to use GREP Styles to add some space between close quotes and footnote numbers that are already styled as superscript, but haven’t been able to figure it out yet. Can anyone help?
Can grep eliminate repeating text? I am doing an index and the beginning of lines are often exact repeats of the line above. I’ve investigated data merge but haven’t found (yet) a solution.
Here’s one for you! (A question, that is!) Can I use a No Break character style to prevent less than four characters as the last line of a paragraph? Really what I’m looking to do is prevent page references in indexes from ending up as the second line of the index entry by themselves.
For example:
Instead of:
Utica Covered Bridge, [linebreak] 102
we would want:
Utica Covered [linebreak] Bridge, 102
Usually we just do this manually, by scanning through and hand-breaking all the lines that have numbers by themselves, but I would be such a hero if I could find a way to use a GREP for it!
Thanks in advance!
@Joanna: A very short line at the end of a paragraph is called a “runt.” I mentioned one way to fix those (with No Break) in this comment earlier.
@David –
Thanks for the quick response. Since I posted, though, I actually came up with my own that’s working perfectly for my specific case of indexes:
(?<=[[:punct:]])\s(?=\d+$)
The "punct" finds the commas that precede the page refs, the \s is, of course, the space that I want to actually apply "No Break" to, and the \d+$ for the one-or-more digits of the refs at the end of the graf.
Woo hoo! This is really my very first foray into GREP, so I'm proud of myself!
Thanks again!
Joanna
Need help with multiline match.
I have tried to match multiline comment with /\*(?s)(.*?)\*/, and it did work in “find and replace”. but when this pattern was in the peragraph grep setting, it didn’t work at all.
Thank you
The Singleline and Multiline modifiers simply don’t work in GREP styles. It’s a limitation, yes, but an understandable one …
(A dirty work-around could be to replace the hard returns inside comments with shift-returns …)
Can I set up a single GREP expression to remove or modify a number of things all at once? i.e, one single expression to find and change all multiple paragraph returns, multiple spaces between sentences, and even the # # # you get at the end of press releases?
@Jerry: yes, with the provision that you should be targetting to only replace them with the same item — for example, you cannot search for two hard returns and replace them with one, and in the same command search for lots of hashes and replace them with nothing.
This will be a convulated GREP because in the case of multiple hard returns, you’ll want to remove all of them except one, the same in the case of multiple spaces, and in the case of the hashes you want all of them removed. The common denominator here is “remove” — which is simply done by leaving the Replace With field blank. As for the search: (disclaimer: it’s 2:09 at night, had an old friend visiting and made it really late talkin’ about the good ol’ days of cutting films and looking for old CRC copies for reprints)
((?<=\r)\r+)|((?<= ) +)|(#{2,})
(Note there are a few spaces inside this expression. Copy and paste, rather then typing it it.)
Hi Jongware,
That does some of it, but not a clean sweep.
I found that if I change (#{2,}) to simply (#), the expression does get rid of the hashes. But it still leaves multiple tabs, when I don’t even want one.
Thanks for your input.
Are you sure you want to remove all hash signs? The #{2,} construction only removes them (all of them) when there are 2 or more in a row. Yours will kill all of them, as in “part #1″.
.. it still leaves multiple tabs, when I dont’ even want one.
Yah … well … you didn’t mention tabs ..
Also — are you sure you want to remove all of them? Text separated by tabs *will* run together, won’t it?
Actually, while it’s doable to do lots of things with a single search-and-replace, you might be better off splitting them into a number of consecutive replaces. You can save each single one, and Peter Kahrel wrote a script to “chain” lots of saved queries.
Hi Jongware,
Peter Kahrel’s chaining script is actually what will work for me best. Thanks for turning me on to it.
Jerry
I’m about to embark on investigating using GREP styles for our business, we are involved in text book publication and I’ve been trying to find a way to apply different text colours for nested styles in different chapters or on different pages, rather than needing a new style for each colour
e.g. one spread will be grammar and all the text styles will be green
the next page will be vocabulary, all the stylesheets should match exactly except the spread colour is red, so the headings, underlines and exercise numbers change from green to red.
the next is blue then back to green again etc etc (these vary but the principal is the same, we don’t want to make these changes manually or create a different document for each spread).
my question is, does GREP recognise page numbers or sections?
wish me luck!
Hello everyone, I have one problem with GREP style, I cant figure out how to configure it to work right.
In document there are used different chemical formulas, so that means some numbers are subscript, others superscript…
the problem is that here: 109/l number 9 should be superscript style – 10(9)/l
I can get it work that 9 is superscript after digit, but don’t know hot to stop it before / sign.
One more question, where could I get some more info on GREPs – like which “formula” means what..
@Seba: Here you go: http://indesignsecrets.com/auto-format-superscript-and-subscript-numbers-using-grep-styles.php
I am producing a brochure with acronyms including CO2. Is there a quick way to get the 2 in CO subscripted automatically? So far I do it by hand and it’s very tedious and miss some…
Jean-Marc: http://indesignsecrets.com/auto-format-superscript-and-subscript-numbers-using-grep-styles.php
Thanks, Jongware. Isn’t that amazing that people so often write a comment without looking at the comments that have gone before them? Jean-Marc, I don’t mean to pick on you, but just look at the two comments before yours!
Uh, David, same goes for me then … :’(
I googled this because I knew the exact same question came up before.
LOL, Theun! Well, we are all guilty of being blind sometimes.
No problem.
First off, let me say that GREP is COMPLETELY foreign to me and I really just don’t understand it. So figuring out if GREP can be used for what I am needing is really confusing.
I have three different block quote Paragraph Styles that I use. We almost always put a space before and after the block quote but not between the paragraphs within the block quote. I have the block quote styles set to automatically add a space before and after so that I do not have to manually do this. Because the before and after space is added with a hard return and when there are multiple paragraphs within a block quote, I do have to manually remove the space. This is very time consuming. I would love to be able to have this space not appear WITHIN my block quote styles and instead only before and after them.
Can I use GREP to solve this?
Thanks in advance for any help! (We are a non-profit organization that publishes books. None of us have any “formal” InDesign training, although we have been using it for years and I just know there are ways to work smarter that we still haven’t figured out!)
Hi!
I’m new to GREP concept and I have this small repetitive task I have to perform and I’m sure the GREPs are my solution. Here’s what I have to do…
I need to change this formating:
(enter)
word
(enter)
word
…to this kind of format:
(space)word(space)word
Thank you for helping me!
Forget it guys…
found it!
Thanks anyways.
have a great one for anyone who has to change Mclaren to McLaren and the like:
(?<=\Mc)[\l\u]
to find the lowercase letter which should be uppercase; then
in the style, make sure that the character style is All Caps.
doesn't sound like much, but when faced with a database of thousands using data merge, applying the style to the surname entry corrects the entries on the fly rather than fixing them in the d'base itself.
I’ve run into an issue with a project where I need to all caps the running headers. With some titles containing registered trademarks.
When pulling data from the paragraph title style (with superscript registered trademarks forced via GREP), the running header style overrides the superscript and makes the registered trademark large again.
I tested to see if turning off the paragraph all caps style would allow the superscript GREP style to work, but it didn’t superscript either. However, if i set the paragraph style to superscript all without all caps on, the entire text superscripted.
Is there a known issue with superscripting individual characters in running headers, or does anyone know of a solution? I’m completely scratching my head on this one. Thanks!
Aaron: the issue at hand is that automatically picked up text such as your running header cannot be selectively formatted. Compare it to attempting to format the first digit of a two-digit automatic page number.
There is this plugin called “Power Headers”, which I think does allow selective formatting; I usually just forget the automatic way and do it ye olde style: manually.
I thought that might be the case, but was hoping for an automatic solution. Fortunately, if i need to manually do it there are only a handful of chapters in the 300 page technical book that need it. Thanks for the quick response Jongware! BTW, fantastic info here for the chemical GREP styles. Will save me loads of time.