soup.find_all doesnt find regex - regex101 does

61 Views Asked by At

I got a html-file and want to change "Test-Dateien" into "other-dir"

since it is nested in some weird outlook vml code i tried using the following regex to access it:

pattern = re.compile(r"\<\!\-\-\[if gte vml 1\]\>\<v\:shape ((.|\n)*?)\-\-\>")

however when regex101 online generator returns match... soup.find_all(text=pattern) returns None

example text copied from soup below:

<p class="MsoNormal"><span style="mso-bookmark:_MailAutoSig"></span><a href="tel:+491624154900"><span style="mso-bookmark:_MailAutoSig"><span style='font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-font-family:
  Calibri;color:#646464;mso-fareast-language:EN-US;mso-no-proof:yes;text-decoration:
  none;text-underline:none'><!--[if gte vml 1]><v:shape id="Bild_x0020_10"
   o:spid="_x0000_i1039" type="#_x0000_t75" href="tel:+491624154900" style='width:13.5pt;
   height:13.5pt;visibility:visible;mso-wrap-style:square' o:button="t">
   <v:imagedata src="Test-Dateien/image004_1.png" o:title=""/>
  </v:shape><![endif]--><?if !vml?><span style="mso-ignore:vglayout"><img border="0" height="18" src="Test-Dateien/image004_1.png" v:shapes="Bild_x0020_10" width="18"/></span><?endif?></span></span><span style="mso-bookmark:_MailAutoSig"></span></a><span style="mso-bookmark:_MailAutoSig"><span style='font-size:10.0pt;font-family:"Arial",sans-serif;mso-fareast-font-family:
  Calibri;mso-fareast-language:EN-US;mso-no-proof:yes'><o:p></o:p></span></span></p>
0

There are 0 best solutions below