On 11 Juni, 17:04, TheSaint <[EMAIL PROTECTED]> wrote:
> On 12:20, mercoledì 11 giugno 2008 cirfu wrote:
>
> > patzln = re.compile("(\w* *)* zlatan ibrahimovic (\w* *)*")
>
> I think that I shouldn't put anything around the phrase you want to find.
>
> patzln = re.compile(r'.*(zlatan ibrahimovic){1,1}.*')
>
> this should do it for you. Unless searching into a special position.
>
> In the other hand, I'd like to understand how I can substitute a variable
> inside a pattern.
>
> if I do:
> import os, re
> EOL= os.linesep
>
> re_EOL= re.compile(r'[?P<EOL>\s+2\t]'))
>
> for line in open('myfile','r').readlines():
>    print re_EOL.sub('',line)
>
> Will it remove tabs, spaces and end-of-line ?
> It's doing but no EOL :(
>
> --
> Mailsweeper Home :http://it.geocities.com/call_me_not_now/index.html



it returns all the sentences. i just want the one containing zlatan
ibrahimovic.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to