https://regex101.com/r/t1Etzx/1/ is doing the regex substitution ok. using sed 4.2.1 on bash:
echo "text curl -u a12345:ypB7HuW9u5yB'_'https://mycompany.com/api/healthcheck"|sed -r 's/(a\d+|A\d+|scl[^:]+):([^\']+)(\'|_)/\1:xxxxx\3/g'
and
echo "text curl -u a12345:ypB7HuW9u5yB'_'https://mycompany.com/api/healthcheck"|sed -E 's/(a\d+|A\d+|scl[^:]+):([^\']+)(\'|_)/\1:xxxxx\3/g'
are giving me
bash: syntax error near unexpected token `)'
A solution in awk welcome too.