>From the BBEdit Find window's grep cheat sheet, (?i) on the find grep 
expression will do case insensitive matches.

Then the question is what do you want the replacement's character casing to 
look like? 

If you want the character casing to conform to the found match's, I don't 
think you can do that with a grep replace pattern.

If your replacement is just a character string of a particular character 
casing format (e.g., MyRePlAcEmEnT) then all you have to do is put that in 
the "Replace:" field and in the "Find:" field Word(?i)

That will find all forms of character casing of "word" and replace it with 
MyRePlAcEmEnT.
On Wednesday, February 28, 2024 at 9:38:23 AM UTC-8 Jim Straus wrote:

> Hello all regex experts -
>   I'm looking to change a word in my code to another one, but it is 
> sometimes "Word", "word" or "WORD".  I can do this with three search and 
> replaces.  I also know about the \u\U modifications to the group (so \u\1 
> to uppercase the first letter), but that doesn't really work, since I'm 
> changing the word (not using the group).  What I think I want is something 
> that would take just the case of the matched group and apply that to 
> replacement text.  Or is there another way to accomplish this in one 
> pattern?
>   Thanks!
> -Jim Straus
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/a852f0c1-b63c-4c61-a823-c030ea03ece2n%40googlegroups.com.

Reply via email to