Sorry, maybe I wasn’t clear. Yes, “word” is a place holder. Think aWord, A_WORD, a_word as possible items to be changed. I want to change them to aSomething, A_SOMETHING, a_something. Searching for “word” in a case insensitive manner is easy, and even capture it. The question is, can I apply the caseness of the captured value to a replacement value. Maybe if there was a conditional replacement that inspects the captured value, I could do it. There are lots of controls available on the search pattern, but it seems not as much on the replacement value. Thanks! -Jim Straus
> On Feb 28, 2024, at 3:14 PM, Brian Forte <[email protected]> wrote: > > On Wed, 28 Feb 2024 11:38:07 -0600, Jim Straus wrote: >> 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? > > The below is simplistic and almost brute-force, but it appears to work. > > I’m assuming ‘word’ is representative. That is, I’m assuming you are > searching for a specific string of letters where the only potential > difference between each example string is the letter case. > > Then > > Search for: [W|w][O|o][R|r][D|d] > Replace with: <whatever spelling case for the ‘word’ string you want> > > Hope this helps. > > Regards, > > Brian Forte. > -- > Brian Forte > <[email protected]> > > -- > 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/20240229065709634649.4025da7c%40adelaide.on.net. -- 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/96210E82-7236-4D4F-8ADF-E86F8F94B10C%40gmail.com.
