You could try modifying it like this. Changing \b to (?<=\b) makes it so the 
match starts at a word boundary but does not include the word boundary in the 
match. With the corresponding change to (?=\b) at the end of the pattern this 
prevents the spaces being part of the match so should prevent the alternating 
behavior. 

And then (?-i) tells it to be case sensitive so you don't need to worry about 
the dialog setting. 

Find: (?-i)(?<=\b)([A-Z]+)(?=\b)
Replace: \L\1

[fletcher]

> On Jun 13, 2023, at 9:33 AM, 'Andy Nickless' via BBEdit Talk 
> <[email protected]> wrote:
> 
> Thank you Kaveh,
> It’s an ongoing project, so any improvement would be very welcome.
> Andy
> 
> On Tuesday, 13 June 2023 at 15:21:50 UTC+1 Kaveh Bazargan wrote:
>> I can look again if it helps. is the job done or useful to have these 
>> enhancements added too?
>> 
>> On Tue, 13 Jun 2023 at 14:40, 'Andy Nickless' via BBEdit Talk 
>> <[email protected] <>> wrote:
>>> Thanks once again, Kaveh.
>>> 
>>> I tried the search:  \b([A-Z]+)\b
>>> and replace: \L\1
>>> It left two word spaces before the lowercase word.
>>> 
>>> When I changed the search to:  ([A-Z]+) with word spaces before and after, 
>>> it did a great job as long as I used the Replace & Find button, but it had 
>>> one or two quirks. For instance, if you had consecutive uppercase words, it 
>>> would only find alternate ones.
>>> Also, it didn't find capitalised words with commas, full-stops exclamation 
>>> marks or question marks. That would be useful.
>>> Lastly, it also found the word I (capitalised, of course) which I didn't 
>>> want it to.
>>> 
>>> I hope I'm not being too greedy!
>>> Thanks so much for your help so far, it's saved me quite a lot of time.
>>> 
>>> On Tuesday, 13 June 2023 at 13:42:14 UTC+1 Kaveh Bazargan wrote:
>>>> Try this:
>>>> 
>>>> search: \b([A-Z]+)\b
>>>> replace: \L\1
>>>> 
>>>> case sensitive
>>>> 
>>>> On Tue, 13 Jun 2023 at 13:25, 'Andy Nickless' via BBEdit Talk 
>>>> <[email protected] <>> wrote:
>>>>> I have some text with random uppercase words (for emphasis) and I want 
>>>>> BBEdit to find them and replace them with lower case words.
>>>>> I ONLY want to change words in which ALL the letters are uppercase - in 
>>>>> other words, leave the capital letters at the beginning of sentences and 
>>>>> names etc.
>>>>> 
>>>>> As an example, if my sentence is:
>>>>> The BIG CAT called George, sat on the DARK BROWN mat.
>>>>> 
>>>>> I would like it to look like this:
>>>>> The big cat called George, sat on the dark brown mat.
>>>>> 
>>>>> Any help with this will be greatly appreciated.
>>>>> Andy
>>>>> 
>>>> 
>>>>> -- 
>>>>> 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/506999f0-7cce-435b-beaf-d5b0ca197b47n%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/bbedit/506999f0-7cce-435b-beaf-d5b0ca197b47n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>> 
>>>> 
>>>> -- 
>>>> Kaveh Bazargan PhD
>>>> Director
>>>> River Valley Technologies <http://rivervalley.io/> ● Twitter 
>>>> <https://twitter.com/rivervalley1000> ● LinkedIn 
>>>> <https://www.linkedin.com/in/bazargankaveh/> ● ORCID 
>>>> <https://orcid.org/0000-0002-1414-9098> ● @[email protected] 
>>>> <https://mastodon.social/@kaveh1000>
>>>> Accelerating the Communication of Research
>>>>  
>>>> <https://www.linkedin.com/posts/bazargankaveh_ismte-innovation-award-recipient-kaveh-bazargan-activity-7039348552526921728-XAEB/?utm_source=share&utm_medium=member_desktop>
>>>>    
>>>> <https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/>
>>> 
>>> 
>>> -- 
>>> 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/e2a1b3dc-ed10-4ade-a4fd-b0cced8a962fn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/bbedit/e2a1b3dc-ed10-4ade-a4fd-b0cced8a962fn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> 
>> 
>> -- 
>> Kaveh Bazargan PhD
>> Director
>> River Valley Technologies <http://rivervalley.io/> ● Twitter 
>> <https://twitter.com/rivervalley1000> ● LinkedIn 
>> <https://www.linkedin.com/in/bazargankaveh/> ● ORCID 
>> <https://orcid.org/0000-0002-1414-9098> ● @[email protected] 
>> <https://mastodon.social/@kaveh1000>
>> Accelerating the Communication of Research
>>  
>> <https://www.linkedin.com/posts/bazargankaveh_ismte-innovation-award-recipient-kaveh-bazargan-activity-7039348552526921728-XAEB/?utm_source=share&utm_medium=member_desktop>
>>    
>> <https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/>
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/c9f328fd-4aff-40da-b336-4e38ea9650c1n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/c9f328fd-4aff-40da-b336-4e38ea9650c1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/ECFCFEBC-B36C-499C-A526-3E0C5EEEF827%40cumuli.com.

Reply via email to