Delete all characters in a multline string upto a given pattern
- by biffabacon
Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like:
#remove all chars up to first occurrence of cat or dog or rat
$pattern = 'cat|dog|rat'
$pagetext =~ s/(.*)($pattern)/$2/xms;
What's the best way to do it in Python?