Most obvious here would be to use sed:
<source sed "s/, characters I don't want\$//"
To substitute that string when found at the end of the line $ which we escape as \$ for the shell (to be future proof in case $/ means something in the shell in the future).
To also remove whatever follows that string if any, replace the \$ with .*, though we'd need to change the locale the C to guarantee .* matches everything up to the end even if that's not valid text in the user's locale:
<source LC_ALL=C sed "s/, characters I don't want.*//"
With GNU grep or compatible, when built with perl-like regexp support, that could be:
<source LC_ALL=C grep -Po "^.*?(?=(, characters I don't want)?\$)"
Or to remove everything if any after that string as well:
<source LC_ALL=C grep -Po "^.*?(?=, characters I don't want|\$)"
Or with pcregrep (when perl-like regex support is enabled in GNU grep, that's actually via libpcre which comes with pcregrep as an example application though has features beyond those of GNU grep):
<source pcregrep -o1 "^(.*?)(, characters I don't want)?\$"
Or to remove everything if any after that string as well:
<source pcregrep -o1 "^(.*?)(, characters I don't want|\$)"
If the text to remove may contain anything including / or regex operators (but not newline characters which wouldn't make sense, nor NUL characters which can be passed in command arguments nor environment variables) and is stored in a shell variable, you do not want to use sed "s/$string\$//" as that would make it a command injection vulnerability.
With the perl-grep ones, you can use:
string='/.*\^$'
<source LC_ALL=C grep -Po "^.*?(?=(\Q$string)?\$)"
<source pcregrep -o1 "^(.*?)(\Q$string\E)?\$"
Or to remove everything if any after that string as well:
<source LC_ALL=C grep -Po "^.*?(?=\Q$string|\$)"
<source pcregrep -o1 "^(.*?)(\Q$string\E|\$)"
That still chokes on $strings that contain \E, though not with as dramatic consequences as with sed.
Or you could use perl directly which has a sed mode with its -p option, has mechanisms to pass arbitrary strings (here using -s for a crude option passing, but you could also use @ARGV directly (equivalent of python's sys.argv) or environment variables (mapped to the %ENV associative array)), and can \Quote strings inside regexps (here with \E in $string not being a problem):
<source perl -spe 's/\Q$string\E$//' -- -string="$string"
Or to remove everything if any after that string as well:
<source perl -spe 's/\Q$string\E.*$//' -- -string="$string"
perl treats input as bytes not as if encoded in the user's locale charset by default, so we don't need to change the locale there.
Note that contrary to sed, the line delimiter is included in the pattern space ($_ in perl on which s/// acts by default) by default and its $ regex operator matches either at the end of the subject or before a line delimiter at the end of the subject so is able to cope with both delimited and undelimited lines.
string.split(", characters I don't want", 1)[0]really only find that string at the end of a line or would it find it anywhere in a line? Is it splitting on a literal string or would it treat that argument as a regexp (in which case you'd have to escape regexp metachars first)?DEF, .*and trying to match on, .*as that'd test if a potential solution was really doing a literal string or a regexp comparison. It'd also be good to have a line where your searched string appears multiple times on the line (e.g.DEF, .*, .*) to see if a potential solution really is matching at the end of the line or anywhere else. There are other use-cases you'll want to cover too I expect.