How to remove all characters before a specific character in Python? February 15, 2023 by Tarik Use re.sub. Just match all the chars upto I then replace the matched chars with I. re.sub(r'^.*?I', 'I', stri)