That should not make a difference then. Are you sure it makes a difference?
But anyway, the last letter is optional, so neither statement is according to specification. The trouble is that you can't really get it to work like this, because of .* at the beginning which becomes too greedy and so the second pattern gets matched..
echo "11111*X*005010X279X~ST*270*1111111*005010X279~BHT*0011*11" | sed 's/[*~]/\n/g' | sed -n '/005010X[0-9]\{3\}[A-Za-z]\{0,1\}/{p;q;}'