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.