I have a string that looks like the following:
sample_string = 'Hello, my name is Bob.\nI like sparkling water.\nMy favorite flavor is mango.\n Goodbye.'I want to do two things:
- Edit the string in a way that removes all characters before the first occurrence of '\n'
- Remove all occurrences of '\n'
I've got #2 sorted out just fine:
sample_string.replace('\n','')But, I'm not sure how to structure a regex expression to pinpoint the first \n and remove all characters before it.
The final string should look like:
final_string = 'I like sparkling water. My favorite flavor is mango. Goodbye.'