Has anyone seen an action that will replace a selected chunk of characters with another character (such as an asterisk ("*") or obfuscated and randomized characters?
An example might be selecting a paragraph of text and you want to replace everything but the first sentence, but retain the same character count for one reason or another. You would then select the portion you want to obfuscate with either a single character such as an * or otherwise and upon pressing the key combo it would replace the selected characters in-place.
Replacing characters would be easy enough, something like:
Search and Replace regex \w
with *
. That would change the first sentence in to.
********* ********** ***** ** **** ******, ********* ****:

If you want to keep the first N characters, that's a bit trickier, but you could break the string in to two parts and then replace one of them and that paste both back in.
Replacing ch******** ***** ** **** ******, ********* ****:

Note that the former would retain most formatting, but the latter will remove a lot of formatting.
1 Like
Thank you. It turns out that \S
seems to work better for a match in my situation. I think I may want to work on "rotating the chars" at some point to give randomized characters within a certain range, but for now this works well.
The below iterates through each character and replaces each one with a random selection from a range of symbols. It leaves punctuation marks, spaces and line breaks unchanged (if you want that). It can be adapted to use whatever symbols or letters you want to use in the replacement text.
EXAMPLE Randomize Selected Text v1.00.kmmacros (9.8 KB)
Click to Show Image of Macro