Reformatting capitalized words in clipboard contents with exceptions

Hi All,
I'm looking for the correct syntax to "paste" the clipboard contents as Proper text, but set up some exclusions.

with function: {=proper({clipboard})}

clipboard text:
MEDICARE BLUE NETWORK

reformat and fill as:

Medicare Blue Network

So, here's the twist: How do I add exceptions for specific text.

For Example:
MEDICARE BLUE PPO NETWORK

Would fill as:

Medicare Blue Ppo Network

What I would like is:

Medicare Blue PPO Network

I'd like to set it up so the proper function does not modify specific words such as PPO, HMO, EPO, POS.

Thanks!

Eoin

Hi Eoin,

Thanks for reaching out. You can add exclusions by using the replace function in Text Blaze to replace "Ppo" with "PPO", "Hmo" with "HMO", and so on, adding as many exceptions as you'd like.

I created a snippet below that does this with one of two methods. The first method uses a for loop to loop through all the exceptions, and replace the key (e.g. Ppo) with the associated value (PPO). The other uses a function called "reduce" that does the same thing on one line, which you can read about in the list function documentation. Feel free to use either version:

{proper_text=proper({clipboard})}
{exceptions=["Ppo":"PPO","Hmo":"HMO","Epo":"EPO","Pos":"POS"]}
{keys_list=keys(exceptions)}

{final_text=(input) -> block
var output = input
for k in keys_list
output = replace(output, k, exceptions[k])
endfor
return output
endblock}
{=final_text(proper_text)}

{=reduce(keys_list, proper_text, (text, k) -> replace(text, k, exceptions[k]))}

You can add as many exceptions as you would like to the exception list by adding another entry in the comma-separated list "exceptions" with the format: "proper version": "all caps version"

Let me know if you have any questions!

Best regards,
Alexander

1 Like

Hi Alexander,
Thank you for your swift reply. My apologies for my delay in responding. January has been a crazy month!
I appreciate the code and the explaination. This will be very helpful for me and my team allowing us to cut and paste while maintaining the look and feel of our output document.
Best of 2026 to you!
Eoin