help to convert

how to convert this perl expression to Python
while (<FIL>) {
s/[\n\r]+/ /g;
if (/<DOC\s+doc_ID=\"(.*?)\".*sys_ID=\"(.*?)\"/i) { #"
${$$hashptr{$sys_Id}}{$doc_Id} = $docstr; #
push(@$doclistptr, $doc_Id);

    $doc_Id = $1;
        $sys_Id = $2;
        $docstr = "";
        $numDocs\+\+;
        next;

Any Idea

Jagan

friends I tried the following
ay = re.match(r' doc_ID=\"(.*?)\".*sys_ID=\"(.*?)\" ', b)
doc_ID = ay.group(1)
print doc_ID

but it shows the following error

doc_ID = ay.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

What may be the problem

Jagan