Regular Expression Skipping Match

Thomas Jollans thomas at jollybox.de
Sat Oct 2 08:48:07 EDT 2010


On Saturday 02 October 2010, it occurred to AON LAZIO to exclaim:
> Hi python pals,
>    I need this help, say I have
>    h = "Hello \n World"
>    How would I create a regular expression that match only "Hello World"?
> (ignore \n in the middle)

What exactly are you looking for? One way to solve your example would be 
simply h[:6] + h[8:] - but I doubt that's what you're looking for. Maybe 
something along the lines of ' '.join(s.strip() for s in h.split('\n')) ? 

>    Thanks in advance



More information about the Python-list mailing list