In Perl syntax where $s is a variable holding a string:
$s=~s/={4,}/===/; # Replace 4 or more equals with just 3 equals.
I do this a lot to remove duplicate, consecutive spaces to one space:
$s=~s/ {2,}/ /g; # Replace 2 or more spaces with just one space.
--
<https://forum.pspad.com/read.php?2,70174,70654>
PSPad freeware editor https://www.pspad.com
