How can I remove a specific character from multi line string using regex in python

Published: 22/09/2019
How can I remove a specific character from multi line string using regex in python
Source: STACKOVERFLOW.COM

I have a multiline string which looks like this: st = '''emp:firstinfo\n :secondinfo\n thirdinfo ''' print(st) What I am trying to do is to skip the second ':' from my string, and get an output which looks like this: '''emp:firstinfo\n secondinfo\n thirdinfo ''' simply put if it starts with a ':' I'm trying to ignore it. Here's what I've done: mat_obj = re.match(r'(.*)\n*(

Read more
Related news
Comment
FACEBOOK