Delete all characters in a multline string upto a given pattern
        Posted  
        
            by biffabacon
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by biffabacon
        
        
        
        Published on 2010-04-17T10:54:50Z
        Indexed on 
            2010/04/17
            11:03 UTC
        
        
        Read the original article
        Hit count: 319
        
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?
© Stack Overflow or respective owner