I want to replace repeated instances of the \"*\" character within a string with a single instance of \"*\". For example if the string is \"*
\"*\"
\"*
without regexp you can use general repeating element removal with checking of '*':
source = "***abc**dee*fg******h" target = ''.join(c for c,n in zip(source, source[1:]+' ') if c+n != '**') print target