in reply to Trim Two Characters On Line

perl -le 'for(@ARGV){ s/(?=SUM).*\K..//; print }' abcSUMcdexx abcSUXcd +exx abcSUMc

Outputs:

abcSUMcde abcSUXcdexx abcSU

( borrowing bits and pieces and ideas from other monks... )