Hi, On Montag, 15. September 2014, Salvatore Bonaccorso wrote: > Hmm, would something wrapping around of the following work? sounds like a good start... > Considering there might be more than one matching group in each line, > so the example holds only for a simplest case again :( are there really examples with two urls in one line? > ----cut---------cut---------cut---------cut---------cut---------cut----- > import re > string = "Fixed by > https://git.kernel.org/linus/57e68e9cd65b4b8eb4045a1e0d0746458502554c > (v3.15-rc1)" print re.search("(?P<url>https?://[^\s]+)", > string).group("url") thats nice, now we just need the part before and after that match ;) cheers, Holger
Attachment:
signature.asc
Description: This is a digitally signed message part.