[Tutor] Help required

vince spicer vinces1979 at gmail.com
Fri Sep 25 23:39:27 CEST 2009


On Fri, Sep 25, 2009 at 1:56 PM, waqas ahmad <waqas805 at hotmail.com> wrote:

>
>
>  Hi,
>
> I dont know it is the right place to post this question. I need help to
> change one search code line . can you help me please.
>
> here is my search method code:
>
> search=re.compile("^#acl InternationalGroup.*\n", re.M).search(pagetext)
>     if search:
>         ret=search.group()
>     else:
>         ret='not defined'
>     return ret
>
> here i am searching for "#acl InternationalGroup" in the pageText and when
> it true is then give me search group.
>
>
> I want to change this for following requirement:
>
> I want to search  for "#acl InternationalGroup" and  "CatInternational" for
> both in the pageText.
> when "#acl InternationalGroup" is not there but only "CatInternational" is
> there. then return me search group.
>
> I shall be thankful to you for any help.
>
> Best Regards,
> Waqas
>
>
>
> ------------------------------
> What can you do with the new Windows Live? Find out<http://www.microsoft.com/windows/windowslive/default.aspx>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
i think this is what you are looking for:



search=re.compile("(#acl\sInternationalGroup|CatInternational).*\n",
re.M).search(pagetext)
if search:
    ret=search.findall()
else:
    ret='not defined'
return ret
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090925/c6c900b0/attachment.html>


More information about the Python-list mailing list