Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Favorite GREP Expressions You Can Use

GREP is an incredibly powerful technology for finding and replacing text. It shows up in several places in InDesign, notably the Find/Change dialog box and the GREP Styles feature. But you don’t always have to figure out all the grep codes yourself! Use the table below to find a grep expression that is close to what you’re looking for. You may need to tweak it a little, or combine some of these to achieve your task.

Then, if you have a grep code you want to share with others, feel free to add it to the comments below. If it’s really helpful, I may steal it and add it to the table in this blog post. Or, if I think of new ones, I’ll just update this table from time to time.

Note: Please don’t use the comments below to ask “what’s the grep code for…”? Instead, use our forums to ask those kinds of questions. Let’s focus the comments below on solutions, rather than questions.

And remember: you don’t need to memorize all these codes. Always look for that @ flyout menu!

Expressing Or

(Milk|Dark) Chocolate Milk Chocolate or Dark Chocolate
(m|M)ilk (c|C)hocolate Milk Chocolate, milk chocolate, milk Chocolate, Milk chocolate
[mM]ilk chocolate milk chocolate or Milk chocolate
[^m]ilk ailk, bilk, etc., but not milk
(?i)milk Case insensitive: Milk, milk, mILk, etc.
colou?r color or colour (the ? means the previous character or expression may or may not be there)

 

Wildcards

[cC][\l\u]+e Any string of letters that starts with c and ends with e, such as chocolate, Chocolate, case, coarse, etc.
\<c\w+e\> Any whole word that begins with c and ends with e
\bc\w+e\b Exactly the same as above, but using \b for ‘word boundary’
\s+$ All spaces at the end of a paragraph
\s+\Z Remove spaces at end of story
[\l\u\d.]+@[\l\u\d.]+ Simple e-mail address (e.g. david@indesignsecrets.com or d2@AB.net)
\d{4} Find any four digits (the curly brace expression is not found in the InDesign @ menu)
[-\u\l\d._]+@[-\u\l\d_]+\.[\u\l]{2,4} More ‘robust’ email (e.g. david-blatner_2@63P.com)
\d+/\d+ any fraction, such as 1/2, 22/7, or 355/113
(?<!\d)(?<!/)\d+/(?!11)(?!0)(?!9)\d{1,3}(?!/)(?!\d) Robust fraction grep: Will find fractions, but leave out dates such as 6/98, 9/11, or 6/17/2012. Unfortunately, it fails on 355/113 (which happens to be a reasonably good approximation of ?, proving that nothing is perfect).
[[=a=]] Find any kind of a, no matter the accent, including a, á, à, ä, etc.
(?<=\d)(rd|th|st) Find st, rd, or th ordinals (such as 1st, 2nd, 3rd) that follow a digit?in order to apply superscript to just the ordinal (not the digit).
(?<=\().+?(?=\)) Find any text inside parentheses, but not including the parentheses. This uses ‘Positive Lookbehind’ and ‘Positive Lookahead’

 

Escape!

\$\d\.\d\d Find a dollar sign followed by one digit, a period, and two digits. Note that the dollar and dot have to be ‘escaped’ because they normally mean something different.
\(.+\) Find anything inside parentheses (again, parens need to be escaped)
\Q(a+b*c?)\E Escape everything; that is, find (a+b*c) exactly, without having to worry about escaping each special character.

 

Fun Tricks

Description Find Change to
Add an anchored object at the beginning of each paragraph (cut object to clipboard first) ^(.) ~C$1
Reverse first and last name (but watch out for middle names or initials, too) ^(\w+)([ .\w]+)? (\w+) $3, $1$2
After reversing the names (see above), fix any last names that started with Van or De. ^(\w+, [ .\w]+) (Van|De) $2 $1
Find and remove duplicate words \b(\w+)\b \1 $1
Find and remove duplicate paragraphs/lines in a list ^(.+\r)\1+ $1
Find lists in which people have actually typed a number followed by a period followed by a space, and apply automatic numbered list style. ^\d+\. ?(.) $1 (and apply paragraph style that includes auto numbers)

 

To learn more about GREP, visit: www.indesignsecrets.com/grep

David Blatner

David Blatner

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at Lynda.com are among the most watched InDesign training in the world. You can find more about David at 63p.com.
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Tags
Related Articles
Comments

157 Comments on “Favorite GREP Expressions You Can Use

  1. Andrea,

    do this:

    create a character style, call it No Break or something similar. Assign it as No Break in the Basic Character Format options.

    Search: – (?=[\u\l])|(?<=[\u\l]) –

    and replace with this character style or add this GREP style into the paragraph style options. This way whenever you have this combination it will be assigned no break automatically.

    Michael

  2. @Michael: Add (.) at the end of your search string, and put $1 in the Replace field.
    If the Replace field is empty, ID only applies formatting. This way, you force a replacement, if only for the single character you are picking up from behind your digit.

  3. I have a GREP challenge I can’t solve – any ideas?

    I need to apply a different style to the last bullet in a list (to allow more space after than the regular bullet style).

    I thought I could search for bulleted style followed by a regular paragraph style, but I can only search for one para style at a time.

    Does anyone know how to do this?

    • I found a way to do this, but you don’t need GREP to do it.

      Use a paragraph style for your bulleted lists. Tell the span to span all columns, and then set your after span space to whatever the measurement is that you wanted.

      It will treat all the bullets as if they were one paragraph and it will add after space on the last bullet.

      I know this is way after you asked your question, but I hope that this helps someone else who is searching this thread for the same answer.

  4. I wanted to apply small caps to all capital letters in a paragraph, but not to those makred in bold (or another character style).

    Is there a solution via GREP styles?

  5. ok, I’m new to GREP.. I need a GREP that will change the style of a URL within the body copy of a document. I’ve created a style. But I can only get the first three characters to change (www). Below is what I have, but I don’t know how to get the remaining information to change.

    [www/./]

  6. @Stacy: The “how to target a URL” is one of the longest-standing discussions in GREP history, I think. :) Here’s the one that John Gruber came up with at Daring Fireball (click link to see his explanation):

    (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»????]))

  7. David, thanks. That’s exactly what I needed. I made one modification:

    (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|(http|ftp|www)\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()]+|\(([^\s()]+|(\([^\s()]+\)))*\))+(?:\(([^\s()]+|(\([^\s()]+\)))*\)|[^\s`!()\[\]{};:??.,?«»????]))

    (http|ftp|www) – added http and ftp into the string which allows me to search and change all three.

  8. Hi I am trying to come up with a search for variable prices
    Price: $48.00
    Price: $32.00

    The prices themselves are variable
    HELP Please

  9. Hi I am trying to come up with a search for add Index entry for Each Text box in my documents (i have aproximaly 1000 text boxes…)
    Grep find/change don’t add index entry…

    Help Please

  10. Hello, I need help in this. I want to delete every letter variation after word BEX. For instance Title-BEX-14 char-style-override-8 should become Title-BEX . How can I do this?

  11. @Rain: You can probably look for \$\d+\.\d\d (dollar sign, one or more digits, dot, two digits). No?

    @Norman: You are correct that InDesign doesn’t let you do this. Look at the IndexMatic script at indiscripts.com

    @burak: Perhaps something like BEX.+ (which means BEX followed by every character until the end of the paragraph)

  12. Hello ? – this great script finds all the text after a tab and before a return. Works like a dream in my paragraph style, thank you?

    (?<=\t).*?(?=\r)
    What I woudl love to find out is how to tune the script to find all the text between TWO consecutive tabs and a return?

    Would be incredibly useful; trying to assign a character style to numbers in an index?

    thanks for your time and assistance!

    Original script found here:

    http://indesignsecrets.com/findbetween-a-useful-grep-string.php/commen t-page-2#comment-550882

  13. If I want to find something after the beginning of a pragraph, I use symbol “^”, but…

    What if I want to find a character that IS NOT in the beginning of a paragrah?

    Thanks

  14. I’m trying to find the beginning of a paragraph to end of paragraph with a specific style. Then I want to insert a tab in front of the found text. I need an actual tab character (i can’t just change it in the style). Any assistance would be greatly appreciated.

    Thanks.

  15. After tons of research I answered my own question by reading up on some of the posts – I should have just done that in the first place.

    Find: \<.+
    Find Format: "my para style"
    Change: \t$0

  16. I am trying to create an expression which will find digits in text that I can then automatically superscript so as to indicate footnotes. I have come up with this but it feels clumsy to me and there must be something more elegant and straightforward.

    (?<!\s.\.)(?<!\d\.)(?<=[.\.])(\d{1,2})

    So for example in the following text only the 1 and the 2 at the end of the sentences would be superscripted. All the other numbers would stay normal. So far it is working but I am worried that there is an instance that I haven't considered which would mean my expression would have to change.

    With 17 of the G20 countries quietly erecting some form of trade protection in the six months immediately following the global financial crisis, it is not surprising that business has grown more skeptical of the power of the Free Trade Agreement.1
    Only one in 20 Australian companies exports their goods or services.2 This is despite the opportunities provided by three decades of growth in the economies of our global neighbourhood, across the Asian region.
    Australian industry has gone through a major transformation through the same period, with the phased collapse of tariffs and other forms of industry assistance. In the past two decades, Australia has become one of the most open economies in the world with average tariffs at less than 3.9 per cent. (p.34)

  17. John, this is one of those things you cannot get 100% right. Best you can hope for is not too many false positives (numbers that are *not* to be picked up) or false negatives (numbers that are notes but are not seen).

    First, I simplified your expression to this basic construction:
    (?<=\.)(\d{1,2})
    That is, just 1 or 2 digits right after a full stop. Since it also picks up decimal numbers, make it ignore these with a negative lookbehind:
    (?<=\.)(?<!\d\.)(\d{1,2})
    This still picks up the one page number. Now, make it check for a compulsory space after:
    (?<=\.)(?<!\d\.)(\d{1,2})(?=\s)
    This works for your example text. Only thing is, if your last footnote number is at the very end of a story, there is no 'space after'. But you can also check the inverse: *not* not-a-space-character.
    (?<=\.)(?<!\d\.)(\d{1,2})(?!\S)

    • Thanks for that Jongware. I have been using GREP for a few years now, but am only just starting to use it to achieve more complicated results in the long docs that I am working on. It is quite arcane but quite exciting to see what you can achieve after some mental gymnastics. A lot of this sort of work (i.e. avoiding runts, footnoting, italicising publication names, etc.) is done manually in the place where I am employed and I am trying to convince the editor, who does a lot of the work himself, that there is a better, quicker way, but he is still stuck in the 1980s when it comes to page layout. Very frustrating, but at least it keeps me in a job. If I were to succeed I would probably end up retrenched, but hopefully we would just produce more work.

  18. Thanks for this great article. I had a book where the author had used strange syntax for the figure numbers: Figure 1-(1) through Figure 23-(18) and I wanted to change all of those to Figure 1.1 through Figure 23.18. Here is my first GREP that I wrote with your help:
    Find What: (Figure\s\d+)\-\((\d+)\)
    Change to: $1.$2
    Thanks again!

  19. Mr. Excel! (Bill Jelen). That’s great! A “clear parentheses” GREP.

    So nice to see you here. Readers: Bill Jelen is the “David and Anne-Marie” of Excel. Check out http://www.mrexcel.com. I know Bill because I taught him and his assistant some project-specific InDesign stuff a couple years ago, for the books he writes about Excel and sells on his site.

  20. how to find italic worlds by the help of grep. Please don’t use style formatting. i want wildcard option

  21. How do you create GREP styles for let say this:

    Sweet Pork (Smaller font)
    Baby Back Ribs (larger font)
    $1.99LB (superscript $, no decimal point, cents in small caps and lb in a small font)… I cant figure it out. Driving nuts!

    Please help

  22. This is a great site and one that I come back to time and time again. I am relatively new to regular expressions, but its easy to see that they are incredibly powerful – i’ve started to make use of them in the publication that I produce. I also referenced this site in my recent blog post (http://www.pixooma.co.uk/blog/2013/07/03/get-to-grips-with-grep/)

    I can see that there are several solutions to finding URLs in text, but let me add in my current solution – I’d love to hear what people think. It’s explained on my blog, but the urls in the magazine I work on don’t have ‘www.’ in front of them:

    (\w+|\w+-|\w+/)*(\w+\.[\l\u]+(\.[\l\u]+)*)(/\w+(/w+|-\w+)*)*

    • Hi Mark, I’m always on the lookout for great GREPs. I tried yours, but immediately ran into a problem … it wouldn’t find the filename extension. For example, for acmedesign.com/about.html, it only found “acme design.com/about” and I’d need it to find the rest, too.

      Here are a few that I’ve saved as queries, though I don’t remember where I got them from:

      “GREP for finding URLs”

      (?i)([a-z][\w-]+:(?! )(?:/{1,3}))(www\d{0,3}[.])?([^ <>/]+\>)|(www\d{0,3}[.])([^ <>/]+\>)

      and “Gruber’s Find ANY URL”

      (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^ ()<>]+|\(([^ ()<>]+|(\([^ ()<>]+\)))*\))+(?:\(([^ ()<>]+|(\([^ ()<>]+\)))*\)|[^ `!()\[\]{};:'”.,<>?«»????]))

      and “Gruber’s simpler find URL”

      (?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^ ()<>]+|\(([^ ()<>]+|(\([^ ()<>]+\)))*\))+(?:\(([^ ()<>]+|(\([^ ()<>]+\)))*\)|[^ `!()\[\]{};:'”.,<>?«»????]))

      (wish I could remember who Gruber was…)

      • Hi Anne-Marie, I looked at the GREPs you posted, but I’ve also been working on this since my last post and I’ve found another solution (I think!) — I’d be interested to know what you think of it. The URL search I need to perform is for the magazine I work on. In the magazine web-addresses do not have the www. or http:// etc in them. The following GREP works for me on all iterations of URLs that I have tried, but what do you think? It seems a bit too good to be true given how short it is, so am I missing something fundamental?

        Here’s the Code: ([^\s]+)\.([^\s]+)

  23. Can you export find/change grep commands to share with other users? I’d like to share some of my more complicated strings with others in my department.

  24. Hello,
    I am new to GREP styles and I have a question. I work for an academic press and often have books with hundreds of notes. The problem we are having is when a note number appears right after a closing quotation mark, often they are too close together. I was hoping I could use GREP find/change to find all of the instances of a closing quotation mark is directly followed by a number and insert a hair space in between them. I have been able to find the instances using ~}(\d) but I can’t figure out what should be in the change to box.

    If someone can help me that would be great!

    • Felicia,

      Have you tried ~}~|(\d)

      I clicked on the @ symbol and went down to “white space”. Hair space is listed under there.

      • Thanks Cynthia! That worked except it changed the note number, do you or anyone else know how to make a change without changing any of the surrounding characters? That is the part that keeps tripping me up. I can’t figure out how to write a code that will insert a space without replacing the note number.

    • Felicia,

      You can create sub-expressions by wrapping them in parentheses. Try the following:

      Find:
      (~})(\d)

      Replace:
      $1~|$2

      $1 stands for the first sub expression and $2 stands for the second.

      Basically we are saying: Find all end quotes( sub-expressions 1) that are immediately followed by a digit (sub-expression 2). Then replace with the results from sub-expression 1, a hair space (~|), and sub-expression 2.

      • Justin,

        That worked, thank you so much! That will save our designers a lot of time and headaches.

    • Felicia,

      Now that I think about it, I would recommend doing this via a Grep Style. That would be non-destructive.

      Add the following Grep Style to your paragraph style:

      ~}(?=\d)

      The associated character style can control the space between the end quotes and digits through the tracking setting. Something like +50 should suffice.

      (?=) is a positive lookahead. So we are saying: Find an end quote only when it is immediately followed by a digit.

  25. I am trying to create an expression so that the first letter of each bullet point is always a capital letter. I am importing copy from different writers and some will treat bullets in the same manner as text following a colon or a semi-colon (i.e. beginning with a lower case letter). Our style guide calls for a capital for which I have created a character stylesheet. The expression I thought would be quite simple ^\l (the first lower case letter at the beginning of a paragraph). The problem I am having is that when I use a soft return the first letter of the following line becomes a capital. Clearly ^ doesn’t distinguish between the end of paragraphs and forced returns. I also would like to exclude “http” and “www” from the taking the Capitals character style sheet where they appear at the beginning of a bulleted paragraph.

    • John,

      In the future you may want to post questions in the forum. It will likely get more coverage.

      The following should work:

      (?<!\n)^\l

      (?<!) is a negative look behind. We are basically saying: Find any lower case letter that is at the beginning of a paragraph which is not following a forced break.

  26. Hi, I am SO close to figuring out this string, but I just can’t get it right:

    ((?<=\d )(a|A)\.?(m|M)\.?)

    I want to find any variation of A.M. that follow a time EXCEPT "a.m."

    Because I will then change all the incorrect am (or pm, in a separate command) variations to "a.m." But I can't seem to get the "exclude a.m." portion right.

    Any advice?

  27. I am laying out a textbook…some of the words are very long, and using the justify line spacing can leave huge gaps between words…the line and paragraph composer are little help, using one causes problems in the other.

    Is there a way to use GREP to find large spaces and replace them with a ‘third space’…which seems to work well with the leading and all that.

    It takes such a long time to hunt down large gaps and paste smaller ones.

    Thank you, Paula

  28. Hi

    But I need to use that in the GREP paragraph style, and not in the find and replace box.

    Actually I have a typed text with paragraphs start with a digit followed by a period and a space.
    I already created my paragraph style with Bullets and Numbering but I need to auto delete the numbers inserted manually at the begging of each paragraph. i.e.
    1.space
    2.space
    3.space
    etc.

    Basically I need to search for:
    ^\d+\. ?
    and replace with nothing.

    Many thanks for your help!

  29. Hi,

    Can you please help me. I need to do a search in which I find a Line with a specific number of characters (fx. 28 characters). Is This posible?

    • Martin,

      Could you elaborate on your need to find these characters? We would need a bit more information to provide a viable solution.

  30. I am making a phonebook in InDesign. And I need do do a search in which I find, all the hits in which the line goes into 2 lines (because of too many characters). I Hope you understand what I mean :O)
    – so I need to do a search in which I find a Line with a specific number of characters (fx. 28 characters). Is This posible?

    • Martin, that would be this:

      .{28}

      — any character, 28 in a row. Or, if you want to match the entire line (so you can do something with it)

      .{28,}

      — 28 or MORE. It will match everything up to the end of a paragraph. Note that GREP is not aware of individual *lines*, it can only work with entire paragraphs.

  31. @ Jongware: Thanks a lot – good job – it works fine for me now.
    Now I have a new task: I need to insert a automatic break character before a Format called: Adress – how do I do this?

  32. You can set up a pattern to find multiple lines of text across line breaks (line breaks, not wrapped lines of text) and place the cursor after your found string using this:
    (?:^.*\n.*\n\K).*

    This finds the third line of text (i.e. the text after the second line break mark in a paragraph) and highlights it.

    It requires typing a paragraph with line breaks (soft returns, i.e. shift+enter), but for something highly predictable like a calendar entry (which is how I am using it) you can take an entire line of text and apply a format to it, regardless of it if wraps visually. In my case:

    Time & location [soft return] (style 1)
    Event title [soft return] (style 1)
    Presentation Title (style 2)
    Blah
    Blah
    Blah

    The key things that I had to draw from various sources were (?:) which basically means “see if this exists, but don’t remember it” and the \K which means “put the cursor here”.

    It took me days of searching and furthering my knowledge of REGEX to figure this out, but thought I would share it in case it helps someone else.

  33. Hello!

    I am trying to figure out something that I am not sure is a GREP problem or another issue. Basically I need to find a series of numbers that look like this: XXXX-XXX and add brackets in the beginning and end of them all. End result should look like this: [XXXX-XXX]

    Is there any easy way to do this within the FInd/Replace?

    Thanks!

    • I would try a grep search that uses wildcards.

      Click on the @ symbol next to the Find what: box. Toggle down until you get to wildcard and then over to “any digit”. Do that 4 times, then add a hyphen, then 3 more times.

      Click on the Change to: box and add a bracket. Then click on the @ symbol next to Change to: box. Toggle down to “Found” and then over to “Found text”. Then add a second bracket.

      Your “Find What:” field should look like this: \d\d\d\d-\d\d\d

      And then Change to: field should look like this: [$0]

      Hope that works for you!

  34. Hello,

    I am working with a list of customer information that have the name, the address, the email address and the url. Each information is in a paragraph.

    I would like to use a grep that can find the paragraph containing the name of the customer (the name of the customer is after the paragraph containing the url) to be able to change its paragraph style.

    Can someone help me with it?

  35. Hello,
    I am working with a list of customer information that have the name, the address, the email address and the url. Each information is in a different paragraph.
    I would like to use a grep that can find all paragraphs containing the name of the customer (the name of the customer is after the paragraph containing the url) to change the paragraph style.
    Can someone help me with it?

  36. Hi.

    What I would like to do is find all words that are duplicated with in a INDD document and replace with a bolded version of the word, or highlighted. Basically I want this function to make any duplicates obvious so I can go through and double check. This is because I proof a lot of artwork. This would make my job much easier.

    Any help would be much appreciated.

  37. I require a GREP code i can’t figure out, I would like to search a document for any string of numbers, including decimal places, and replace the decimal point with a comma or replace a thousandth separator with a decimal point or a 10000’s separator with a space? so 4.1 becomes 4,1 and 4000 becomes 4.000 and 40,000 would become 40 000 for example.

  38. Hughes, Cambell, Joe, and others: Please see my comment in the original article above… it’s far better to ask these kinds of “how can I?” or “what is the code for” questions in our forums, rather than on this blog post.

  39. Today, while I was at work, my sister stole my apple ipad and tested to see if it
    can survive a twenty five foot drop, just so
    she can be a youtube sensation. My apple ipad is now broken and she has 83 views.
    I know this is totally off topic but I had to
    share it with someone!

  40. Hello, I was in the InDesign Forum, and someone there suggested I look at using GREP for my dilema.

    I have a textbox the I want to make into either a solid, or replace with a bullet based upon the condition that if the textbox has a “1” in it (it would only be either “1” or “0”. In essence I need to turn on or off a box that way. My data is coming froma csv file. I can see the 1 or 0 in the textbox, but have no understanding of scripting to make that on/off thing happen. Do you have any suggestions, or GREP that might work?

    Thanks,

    Ben

    • Ben: I would suggest just doing a find/change… find everywhere that it just has a “1” by itself in a text frame and then replace it with a character from zapf dingbats or some symbol font that looks like the box you want to use. etc.

      • Dave, thanks for the suggestion. I need to print these documents, so that is why I need to automate. Not sure is find/replace would work when going to print.

        Ben

  41. Hello!
    I want to do something in specific. I try to put into an anchored objet all the Titles of chapter, but i don’t know how!!!
    First i put an anchored objet in the beginning of pharagraph whit an expression like this:

    Description Find Change to
    Add an anchored object at the beginning of each paragraph (cut object to clipboard first) ^(.) ~C$1

    Now I want this Find text go inside my anchored object.
    Please help me!
    Thanks

  42. HI, thanks for the info above. All really useful. I have one recurring issue… I have text (for an index listing) that is always supplied in MSWord, with varying amounts of individual dots between the words and page numbers. Despite many attempts to explain about tabs to the client, they always send the text this way and I end up having to manually double-click the dots and add a righthand tab to force the page number to the righthand side of the column.

    Is there something in grep that will search for these multiples dots and replace them with a righthand tab? Any pointers would be great. Thanks Guys… keep up the good work!

    • Dave: You could open the GREP tab of the Find/Change dialog box and search for \.[. ]+ then replace it with ~y
      In the grep code, that’s both a dot and a space inside the brackets — that means, a dot followed by a string of either dots or spaces, so it will find ……. and . . . . . .

      • David, you just saved me two hours work! Thank you so very much. Really appreciated! It works a treat.

  43. Regarding the first expression under “Escape!” (\$\d\.\d\d)…
    Wouldn’t it be better to just use “\$\d+\.\d+”? That way it would find all possible amounts.

  44. David, I am trying to write a GREP that will look for paragraphs that have NO COMMA in them, and apply a style to them. Is there a way that you know of to write GREP to look for the absence of a character?

    • Ax, thanks! That was exactly what I was looking for, and it works perfectly. Can you explain to me how the negation works, so I can apply it in other code. I understand that ^ refers to the beginning of the paragraph, and the +$ is looking for repeated instances up till the end of the paragraph. But I don’t understand exactly the framework of [^,].