Converting Perl Regex to Python!

Miloslav Nic nicmila at
Tue Dec 5 02:53:14 EST 2000

Examples in Zvon Regular expression reference:

 are generated with Python, on the basic level with the re module 
there is no difference

thelocust at wrote:
> I'm working on porting a program from Perl to Python, and i'm to a
> point where I need to convert their Perl regex stuff over to python.
> Now, I understand what is going on in the Perl if statement below, but
> i haven't seen to many good examples of regex stuff for Python, so i'm
> hurting for an translation
> The string i need to grab the info from looks like this:
> MSG notify timecode [00:00:00:00]
> if ($msg =~ /^MSG notify timecode \[(\d\d:\d\d:\d\d):\d\d\]/) {
>     $cajun->{state_clock}=$1;
>     }
> So, how exactly do i convert this to python?
> Sent via
> Before you buy.

<firstName> Miloslav </firstName>    
<surname>   Nic      </surname>     

<mail>    nicmila at    </mail>   
<support>  </support>

More information about the Python-list mailing list