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

Using GREP to Make a Character Lowercase

On another post, Eugene wrote: “All the section numbers within text had to be written as s123, but some wisecrack decided to to put them in as S123.” This was clearly a case in which there was a “regular pattern of text” and therefore for find/change with GREP. But he was having trouble figuring out what GREP codes should be. I found one solution, but it seems like there should be a easier way.

The problem is that the GREP tab of the Find/Change dialog box doesn’t offer a Case Sensitive button. I searched for \<S(\d). That means “at the start of a word, find a capital S followed by a digit). And then I replaced with with s$1 (which should mean a lowercase “s” followed by the digit that was found)

But does this work? No. Because InDesign apparently thinks that case-sensitive is turned off, so it figures that the uppercase S should be replaced by another uppercase character. Grrr.

There are codes in most GREP implementations that let you convert text from upper to lower case (or vice versa), but I can’t get them to work in InDesign.

The solution I found was to copy a lower case “s” to the clipboard, then use this expression in the Change To field: ~C$1 (which pastes the unformatted contents of the clipboard, followed by the digit)

I am definitely no GREP expert, so I’m curious to hear what other folks here might suggest. (Please only post suggestions that you’ve found actually work.)

Here’s another post on GREP by Michael Murphy, though it was written before CS3 came out.

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 are among the most watched InDesign training in the world. You can find more about David at
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Related Articles

38 Comments on “Using GREP to Make a Character Lowercase

  1. Brilliant, I’ll use that from now on and save it. I was stressing out earlier on how to do this and when I found my solution i thought I was a genius, that way is a little more elegant, I’ll have to write it down in my little GREP journal that I’ve started. Thanks a million.


  2. I would do it slightly differently.

    In fact, I don’t even need GREP to do it. I could do it in CS2 or before.

    Create an empty character style that I’ll call Tag.

    Search for S^9^9^9
    and apply the Tag style.

    Then search for S with the Tag style and replace with a lowercase s.

    This is the kind of stuff I’ve been doing with wildcards for years.

  3. Vectorbabe has been riding with the wildcard cowpokes who’ve roamed the range, lassoing hacked-up and lopped-off email text and russling it back into shape for lo! these many years.

    Before GREP, some of the most ingenious Word macros for text cleanup ever known were spotted in the wild. To appropriate the sentiments of Samuel Johnson, those early kludges and workarounds were like a dog’s walking on his hind legs: far from elegant, but you were surprised to find them done at all.

  4. (second try, think the comments don’t like the backslash char??)

    Find What: \
    Change to: ~hs$1

    This works as long as the paragraph style isn’t relying on an End Nested Style Here character.

  5. b.t.w. for what it’s worth, I tried marking up the code with the pre-tag, but that wasn’t appreciated either.

    how did you manage to include the greaterthan char David?

  6. Vectorbabe, thank you for your feedback. It is a good way of doing it, and I wish I had thought of that sooner.

    The purpose of doing it with GREP was to do it with GREP, I thought it was going to be easy to do it, which it probably is.

    What’s not mentioned in the main post above is that I selected the Case Sensitive in the Find Text tab, then searched my GREP in the GREP tab, and only then did the lowercase become active in the replace.

    Also, I couldn’t replace them all, nothing happened when I pressed that button, but I did change them one at a time in a few minutes.

    My main issue was that I didn’t want to apply Character Styles to everything I wanted to change to lowercase, and there was no “Case Sensitive” switch on the GREP dialouge box plus, the “change all “button did nothing with the case sensitive switch on the “FIND” tab selected.

  7. Sandee (v.b.): Great non-GREP idea! Wish I had thought of that.

    Cari: Yes, this is going to be an interesting challenge. When you type a lessthan (<) character (which I think you mean… not greater than), WordPress assumes you’re going to type some HTML. I think it should work if you type “& lt ;” (but without the quotes or spaces).

    But as for your replacement code: ~hs$1… You’re adding an end nested style character at the beginning. Wow! Why does that work?

  8. You could also do a combination GREP/old fashioned find/replace. Not that the Vectobabe solution isn’t good but it just runs into problems if you have number sequences of different lengths. I also don’t like adding character styles just for find/replace purposes.

    What you could do is a GREP search that replaces the uppercase “S” to something that is not found in the document i.e. \ %s%$1 – and then do a normal find/replace when you change %s% to the lowercase s.

    Agreed that this is something that GREP should handle – but it’s a little better than just assigning character styles when not really needed.

  9. That’s too bad — in BBEdit, you can put case transformations in the replace field (\u, \U, \l, \L, \E). Very useful.

  10. David, phew? talk about having a bad ‘comment’ day… couldn?t even get my < and > s right :) :)

    ?Change To? doesn’t seem to acknowledge a literal lower case character as a first character.

    The ?End Nested Style Here? char, takes up no space and turns into a hidden first character. The literal ?s? will then work, as it is no longer the first character

    Even when I tried using Unicode ?\x{0073}?, which should be a lower case ?s?, I ended up with an upper case ?S?.

    Not sure if this would be a feature or a bug ;)

  11. While working with rule above the text in InDesign CS2, the above rule with offset is placed away from the text frame. I want it to be placed within the (or top of) frame as in QuarkXpress. ANy suggestion please ….

  12. H.M., your question doesn’t really have anything to do with this post, I think… but the answer is: CS3 has this feature!

  13. Found another solution, which I think is the best of the GREP solutions… as it requires minimal steps and does not include usage of a hidden character.

    Insert a NUL character first (Unicode Value 0000). This does nothing as far as I am aware. But you can now type that lower case ?s? without any problems.


    Find what: \<S(\d+)

    Change to: \x{0000}s$1

  14. After listening to podcast number 70, I find that there is still no answer to the basic question:

    How do you Search for entire paragraphs of ALL CAPPED text and convert it all to lowercase, sentencecase, or titlecase?

    In many text situations, there are paragraphs occurring throughout text where the writer used ALL CAPS.

    An ideal GREP search would find all uppercase words in the entire paragraph; convert to another case; then move on to find the next randomly-occurring paragraph with the same affliction.

    I can’t get InDesign CS3 to do it, yet. I noticed David began to comment on that aspect in the podcast (70) and then Anne Marie steered the conversation in a different direction.

    This need seems so essential to me, that it leaves me thinking that GREP search would certainly allow for this.

    From what I’ve read, other GREP softwares CAN do this, but InDesign cannot.

    What are others finding on this?

    Mike Witherell in Maryland

  15. How do you fix a typo when an uppercase character has been typed between two lowercase characters such as:


    to this:


    I?ve tried all the variations in this blog archive, been able to isolate the uppercase L but cannot figure how to change it to a lowercase L.

    Appreciate any answer.

  16. Mike:

    You can just search for normal text, you won’t need GREP. In the find format section you can just search for BASIC CHARACTER STYLE>CASE>ALL CAPS


    Keep in mind that the caps text refers to sections of the Find Format and Change Format of the find panel.


    There isn’t a way to change a character style to lower case, you would need a script to do this.


    This grep search will find all uppercase letters in between words, but I can’t think of a way to make them lowercase.


  17. To convert a grep to lowercase (and have it work on variable text), you need a script. Here’s a script I recently wrote which uses this technique to convert all caps to small caps:

    To convert an grep to lowercase in your current doc, set your grep in the dialog, and run this script:

    finds = app.documents[0].findGrep();


  18. Harbs, that’s a fascinating script! It is very clever to let the user type the GREP into the Find/Change dialog box, then you grab what they typed and use it in your script. Seems to work great.

    Makes me think: It would be so cool if there were a “run this script on All” button inside the Find/Change dialog box. Interesting…

  19. Or just an action panel would do.

    Find GREP. Run Script. Repeat until done.

    Then of course you could have many more actions saved, removing the need to repeat yourself in InDesign.

    OR, you of course could have the option for lowercase in the field of cases in the change format dialog box.

  20. Thanks guys for all the input.

    Being new to this scripting angle, is the displayed example script (not the smallcaps zipped one) from Harbs a Java script?

    If so I simple must copy and paste his text into BBEdit and save the file with an extension of .jsx and move it into my IDCS3 scripts folder?

  21. Figured it out.

    Double-clicked on Harbs CapsToSmallCaps script which opened my ExtendScript Toolkit 2 app.

    Copied/pasted below text

    finds = app.documents[0].findGrep();

    into a new script window, saved new script into IDCS3 scripts folder, did the GREP search, ran the script, PERFECT!!!

    Thank you again.

  22. You can just search for normal text, you won?t need GREP. In the find format section you can just search for BASIC CHARACTER STYLE>CASE>ALL CAPS


    Keep in mind that the caps text refers to sections of the Find Format and Change Format of the find panel.

    This doesn’t work if the writer has actually typed in all caps in the first place. Whether the text is formatted

  23. Hi there. Thanks for the wisdom and insights. I’m new to this and just trying to get my head around it. Can you help with this GREP problem in indesign.

    I have 300 pages that I want to change the first character of a bullet point to lowercase. It would also be nice to remove the full stop at the end of the bullet point. As some bullet points contain several sentences, it would need to omit the full stops and capitalised sentences within the paragraphs.

    Any help appreciated!

  24. @jezabellabingbong: Unfortunately, it’s going to be a bit of a slog to make it work. You might be able to fit together grep and the script mentioned above to make the conversion, but it won’t be a slam-dunk.

  25. Right then everybody, you are all completely brillliant as far as I can see.

    I have made this work on a GRPE query hard coded into the script to turn everything on a line in a document after Company: from UPPERCASE to lowercase

    What do I need to know to now make it work for Title Case???

  26. My approach with InDesign is to export stories to tagged text files, and then run scripts or grep on *those*. I got sick of relearning and rewriting all my scripts every time I upgraded ID.. Later versions of ID have had some support for grep – which is great – but I still prefer to export to txt and run with that.

  27. Pingback: InDesignSecrets Podcast 180 | InDesignSecrets

  28. Harbs, I know it’s been 10 years since you posted your message, but thank you for your script! I’m very happy I found it, not only because you just saved me time but also because as a newbie coder it inspires me to write other codes starting with a GREP search. Thank you :-)

Leave a Reply

Your email address will not be published. Required fields are marked *