Sign in to follow this  
Followers 0
ATR

StringRegExp Problem

3 posts in this topic

Hi all,

I don't understand my problem ! I have lots of HTML files, and ther is multiples files, the regex doesn't work properly !

My regex is :

Local $Array = 0
    Local $Offset = 1
    While 1
        $Array = StringRegExp($HTML, '(?i)"(/uploadedFiles/(?:[^/]*)\.pdf)"', 1, $Offset)
        If @error Then ExitLoop
        $Offset = @extended
        For $z = 0 To UBound($Array) - 1
            ConsoleWrite("Link : " & $Array[$z] & @LF)
        Next
    WEnd
<!-- main content --><!-- Right content starts  --><DIV id=rightnav><DIV class="commonContainer fltrt"><!-- Pagination starts  --><UL class="pagination fltlft"><LI>Structures</LI><LI>&nbsp;&gt;&nbsp;<A href="/ProductGrid/ByProduct/?categoryId=8589934589&amp;tab=1">Formulate</A></LI><LI>&nbsp;&gt;&nbsp;<A href="/ProductGrid/ByProduct/?categoryId=8589934608&amp;tab=1">Murs d'images</A></LI></UL><!-- Pagination ends  --><P class=clear>&nbsp;</P><!-- Container left starts  --><DIV class="prdctDemonstrationLt fltlft"><DIV class=prductTitle><H1 class=heading>Formulate Droit</H1><H2 class=heading>FMLT-WS10-01</H2></DIV><!-- gallery starts --><DIV id=img_gallery><A id=moveleft href="#"></A><DIV id=galleryWrapper><UL id=items><LI><A class=item id=first href="/uploadedImages/formulate-droit-L.jpg"><IMG class=thumb alt="Formulate Droit - Face" src="/uploadedImages/formulate-droit-S.jpg"> <SPAN>Formulate Droit - Face</SPAN> </A></LI><LI><A class=item href="/uploadedImages/formulate-connecteurs-L(3).jpg"><IMG class=thumb alt="Facilité de montage" src="/uploadedImages/formulate-connecteurs-S(2).jpg"> <SPAN>Facilité de montage</SPAN> </A></LI><LI><A class=item href="/uploadedImages/formulate-mat-elastique-L(1).jpg"><IMG class=thumb alt="Mât à élastique" src="/uploadedImages/formulate-mat-elastique-S(1).jpg"> <SPAN>Mât à élastique</SPAN> </A></LI><LI><A class=item href="/uploadedImages/formulate-droit-pied-L.jpg"><IMG class=thumb alt=Pieds src="/uploadedImages/formulate-droit-pied-S.jpg"> <SPAN>Pieds</SPAN> </A></LI><LI><A class=item href="/uploadedImages/formulate-droit-sac-L.jpg"><IMG class=thumb alt="Sac de transport" src="/uploadedImages/formulate-droit-sac-S.jpg"> <SPAN>Sac de transport</SPAN> </A></LI></UL></DIV><A id=A1 href="#"></A><P class=clear>&nbsp;</P><DIV id=fullimg><IMG alt="Main Image" src="http://www.ultimadisplays.fr/uploadedImages/formulate-droit-L.jpg"><P>Formulate Droit - Face</P></DIV></DIV><P class=clear>&nbsp;</P><!-- gallery ends --><UL class="prdctRatingLinks fltlft"><LI><A href="/icons/"><IMG title="Conçus au Royaume-Uni" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_DesignedInUk src="images/ico1.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title=Recyclable id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_Recyclable src="images/ico2.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title="Off The Shelf" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_OffTheShelf src="images/ico4.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title="Garantis 5 ans" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_FiveYearGuarantee src="images/5-year-guarantee.GIF"></A></LI><LI><A href="/icons/"></A></LI></UL></DIV><!-- Container left ends  --><!-- Container right starts  --><DIV class="prdctDemonstrationRt fltrt"><DIV class="descriptionBlock fltrt"><H6 class=heading>Description</H6><P class=cmnTxt><P><STRONG>Avantages</STRONG></P><P>&nbsp;Mur d’image avec housse en tissu imprimé (recto/verso) qui épouse&nbsp;</P><P>&nbsp; &nbsp; parfaitement les contours de la structure</P><P>&nbsp;<SPAN style="FONT-SIZE: 10pt">&nbsp;Grande visibilité des messages</SPAN></P><P>&nbsp;Pieds et sac de transport en nylon inclus</P><P>&nbsp;Montage simple sans outils avec système de repérage</P><P>&nbsp;</P><P><STRONG>Composition et Finitions</STRONG></P><P>&nbsp;Structure en aluminium anodisé</P><P>&nbsp;Structure tubulaire 30 mm de diamètre avec élastique</P><P>&nbsp;Housse en tissu stretch avec fermeture éclair</P><P></P></DIV><P class=clear>&nbsp;</P><!-- Control with Hardware/Graphics lists starts here --><!-- smlContainer starts  --><DIV class=smlContainer><P class=header>Choisissez parmis les différentes options du produit</P><SELECT name=ctl00$ctl00$ContentPlaceHolderMain$ContentPlaceHolderMain$uxProductDetail$uxProductDetailVarientLists$uxHardwareVarientsList class=selectOpt id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxProductDetailVarientLists_uxHardwareVarientsList onchange="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$ContentPlaceHolderMain$ContentPlaceHolderMain$uxProductDetail$uxProductDetailVarientLists$uxHardwareVarientsList\',\'\')', 0)"> <OPTION value=FMLT-WS10-01 selected>Formulate Droit - FMLT-WS10-01</OPTION></SELECT> </DIV><!-- smlContainer ends  --><!-- smlContainer starts  --><!-- smlContainer ends  --><P class=clear>&nbsp;</P><!-- Control with Hardware/Graphics lists ends here --><!-- Prices Control starts here  --><!-- Prices Control ends here  --><P class=clear>&nbsp;</P></DIV><!-- Container right ends  --><P class=clear>&nbsp;</P></DIV><!-- TabContainer starts  --><DIV class="tabContainer fltrt tabContainerTopSpace"><UL class="simpleTabs fltlft"><LI class=active jQuery1474548034994="28"><A href="#tab0">Caractéristiques</A></LI><LI jQuery1474548034994="29"><A href="#tab1">Visuel</A></LI></UL><DIV class="tabDescription fltlft"><DIV class=tabDescription_content id=tab0 style="DISPLAY: block" jQuery1474548034994="26"><DIV class=prodDesc><P style="FONT-SIZE: 12px; BORDER-TOP: 0px; FONT-FAMILY: Arial, Helvetica, sans-serif; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; COLOR: rgb(88,88,90); OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; LINE-HEIGHT: 16px; PADDING-RIGHT: 0px; BACKGROUND-COLOR: rgb(199,234,251)"><SPAN style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; FONT-STYLE: inherit; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; PADDING-RIGHT: 0px">Téléchargez la fiche technique ci-dessous</SPAN></P><DIV><SPAN style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; FONT-STYLE: inherit; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; PADDING-RIGHT: 0px"><BR></SPAN></DIV><DIV class=rightdownload id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl00_DownloadLinkContainer><P class="newDownloadLink fltrt"><A href="/uploadedFiles/formulate-droit(1).pdf"><IMG id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl00_uxTabLinkImage src="/images/download.png"> <BR>Fiche technique </A></P></DIV><P class=smlInstruction>*Please test your substrate suitability before use </P></DIV></DIV><DIV class=tabDescription_content id=tab1 style="DISPLAY: none" jQuery1474548034994="27"><DIV class=prodDesc><SPAN style="FONT-SIZE: 12px; BORDER-TOP: 0px; FONT-FAMILY: Arial, Helvetica, sans-serif; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; COLOR: rgb(88,88,90); OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; LINE-HEIGHT: 16px; PADDING-RIGHT: 0px; BACKGROUND-COLOR: rgb(199,234,251)"><FONT face="Arial, Helvetica, sans-serif" style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; FONT-STYLE: inherit; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; PADDING-RIGHT: 0px">Nous vous invitons à télécharger le gabarit d'impression sur notre</FONT><A title=&nbsp;Ftp style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; FONT-STYLE: inherit; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; PADDING-RIGHT: 0px" href="http://www.gfxupload.fr/?login=udf_anon:password">&nbsp;</A></SPAN><FONT face="Arial, Helvetica, sans-serif" style="FONT-SIZE: 12px; BORDER-TOP: 0px; FONT-FAMILY: Arial, Helvetica, sans-serif; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; COLOR: rgb(88,88,90); OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; LINE-HEIGHT: 16px; PADDING-RIGHT: 0px; BACKGROUND-COLOR: rgb(199,234,251)"><A title=&nbsp;Ftp href="http://www.gfxupload.fr/?login=udf_anon:password"><SPAN style="BORDER-TOP: 0px; BORDER-RIGHT: 0px; VERTICAL-ALIGN: baseline; BORDER-BOTTOM: 0px; OUTLINE-WIDTH: 0px; PADDING-BOTTOM: 0px; FONT-STYLE: inherit; PADDING-TOP: 0px; OUTLINE-STYLE: none; PADDING-LEFT: 0px; BORDER-LEFT: 0px; MARGIN: 0px; OUTLINE-COLOR: invert; PADDING-RIGHT: 0px">Ftp</SPAN></A></FONT> <P class=smlInstruction>*Please test your substrate suitability before use </P></DIV></DIV></DIV></DIV><!-- TabContainer ends  --><P class=clear>&nbsp;</P></DIV><!-- end main content -->

With the HTML above, the RegEx works ! but with the HTML below the RegEx doesn't work !!!! 

<!-- main content --><!-- Right content starts  --><DIV id=rightnav><DIV class="commonContainer fltrt"><!-- Pagination starts  --><UL class="pagination fltlft"><LI><A href="/ProductGrid/ByApplication/?categoryId=226">Tournées</A></LI></UL><!-- Pagination ends  --><P class=clear>&nbsp;</P><!-- Container left starts  --><DIV class="prdctDemonstrationLt fltlft"><DIV class=prductTitle><H1 class=heading>Atlantic</H1><H2 class=heading>UB198</H2></DIV><!-- gallery starts --><DIV id=img_gallery><A id=moveleft href="#"></A><DIV id=galleryWrapper><UL id=items><LI><A class=item id=first href="/uploadedImages/Product_Images/Basics_Range/atlantic-large.jpg"><IMG class=thumb alt=Atlantic src="/uploadedImages/Product_Images/Basics_Range/atlantic-small.jpg"> <SPAN>Atlantic</SPAN> </A></LI><LI><A class=item href="/uploadedImages/Product_Images/Basics_Range/Atlantic_Dos_Large.jpg"><IMG class=thumb alt="Atlantic dos" src="/uploadedImages/Product_Images/Basics_Range/atlantic_dos_Small.jpg"> <SPAN>Atlantic dos</SPAN> </A></LI></UL></DIV><A id=A1 href="#"></A><P class=clear>&nbsp;</P><DIV id=fullimg><IMG alt="Main Image" src="http://www.ultimadisplays.fr/uploadedImages/Product_Images/Basics_Range/atlantic-large.jpg"><P>Atlantic</P></DIV></DIV><P class=clear>&nbsp;</P><!-- gallery ends --><UL class="prdctRatingLinks fltlft"><LI><A href="/icons/"><IMG title="Conçus au Royaume-Uni" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_DesignedInUk src="../images/ico1.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title=Recyclable id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_Recyclable src="../images/ico2.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title="Off The Shelf" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_OffTheShelf src="../images/ico4.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"><IMG title="Garantis 1 ans" id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_OneYearGuarantee src="../images/ico6.gif"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI><LI><A href="/icons/"></A></LI></UL></DIV><!-- Container left ends  --><!-- Container right starts  --><DIV class="prdctDemonstrationRt fltrt"><DIV class="descriptionBlock fltrt"><H6 class=heading>Description</H6><P class=cmnTxt><P>L’Atlantic est simple d’utilisation et propose un montage du visuel avec son rail clippant et micro-velcro permettant un changement de visuel.<BR><BR></P><UL><LI>Enrouleur de la gamme Basic.</LI><LI>Disponible en largeur 800 ou 1000 mm.</LI><LI>Pied stabilisateur.</LI><LI>Rail supérieur clippant.</LI><LI>Fixation au carter par bande micro-velcro.</LI><LI>Aluminium anodisé.</LI><LI>Emballés par 6.</LI><LI>Sac de transport inclus.</LI></UL><P>&nbsp;</P><P></P></DIV><P class=clear>&nbsp;</P><!-- Control with Hardware/Graphics lists starts here --><!-- smlContainer starts  --><DIV class=smlContainer><P class=header>Choisissez parmis les différentes options du produit</P><SELECT name=ctl00$ctl00$ContentPlaceHolderMain$ContentPlaceHolderMain$uxProductDetail$uxProductDetailVarientLists$uxHardwareVarientsList class=selectOpt id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxProductDetailVarientLists_uxHardwareVarientsList onchange="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$ContentPlaceHolderMain$ContentPlaceHolderMain$uxProductDetail$uxProductDetailVarientLists$uxHardwareVarientsList\',\'\')', 0)"> <OPTION value=UB198-800 selected>UB198-800 - Atlantic 800 mm</OPTION> <OPTION value=UB198-1000>UB198-1000 - Atlantic 1000 mm</OPTION></SELECT> </DIV><!-- smlContainer ends  --><!-- smlContainer starts  --><!-- smlContainer ends  --><P class=clear>&nbsp;</P><!-- Control with Hardware/Graphics lists ends here --><!-- Prices Control starts here  --><!-- Prices Control ends here  --><P class=clear>&nbsp;</P></DIV><!-- Container right ends  --><P class=clear>&nbsp;</P></DIV><!-- TabContainer starts  --><DIV class="tabContainer fltrt tabContainerTopSpace"><UL class="simpleTabs fltlft"><LI class=active jQuery1474548040217="29"><A href="#tab0">Structure</A></LI><LI jQuery1474548040217="30"><A href="#tab1">Visuel</A></LI><LI jQuery1474548040217="31"><A href="#tab2">Accessoires</A></LI></UL><DIV class="tabDescription fltlft"><DIV class=tabDescription_content id=tab0 style="DISPLAY: block" jQuery1474548040217="26"><DIV class=prodDesc><P><STRONG>Dimensions (mm)</STRONG>:<BR>800 : 2110 (h) x 830 (l) x 445 (p)<BR>1000 : 2110 (h) x 1030(l) x 445 (p)</P><P><BR><STRONG>Poids</STRONG> :<BR>800: 3 kg (sac de transport inclus)<BR>1000: 3.5 kg (sac de transport inclus)</P><DIV class=rightdownload id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl00_DownloadLinkContainer><P class="newDownloadLink fltrt"><A href="/uploadedFiles/User_Instructions/ATLANTIC_V3_janvier_2015.pdf"><IMG id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl00_uxTabLinkImage src="/images/download.png"> <BR>Fiche technique </A></P></DIV><P class=smlInstruction>*Please test your substrate suitability before use </P></DIV></DIV><DIV class=tabDescription_content id=tab1 style="DISPLAY: none" jQuery1474548040217="27"><DIV class=prodDesc><P><STRONG>Format total du visuel (mm)</STRONG>:<BR>2210* (h) x 800/1000 (l)<BR>*200 mm inclus (non-visible) pour la fixation à l’enrouleur.</P><P><BR><STRONG>Surface visible du visuel (mm)</STRONG>: 2010 (h) x 800/1000 (l)</P><P><BR><STRONG>Support d'impression</STRONG>:<BR>Il est recommandé d’utiliser une épaisseur entre 225 et 300 microns pour le visuel.</P><P>&nbsp;</P><P><STRONG>Accessoires recommandés</STRONG>: Bande micro-velcro (réf -AG720C) pour le renouvellement du visuel.</P><DIV class=rightdownload id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl01_DownloadLinkContainer><P class="newDownloadLink fltrt"><A href="/uploadedFiles/Graphic_Templates/Eco(1).zip"><IMG id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_uxTabsContentRepeater_ctl01_uxTabLinkImage src="/images/download.png"> <BR>Fiche technique </A></P></DIV><P class=smlInstruction>*Please test your substrate suitability before use </P></DIV></DIV><DIV class=tabDescription_content id=tab2 style="DISPLAY: none" jQuery1474548040217="28"><DIV class=accessory><DIV id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_AccessoriesRepeater_ctl00_AccessoriesPanel><IMG class=float:left; alt=img src="/uploadedImages/Product_Images/Lighting/Powerspot250_Thumbnail.jpg"> <P><A href="/Powerspot-250/">Powerspot 250</A><BR>Codice PS250</P></DIV><DIV id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_AccessoriesRepeater_ctl01_AccessoriesPanel><IMG class=float:left; alt=img src="/uploadedImages/Product_Images/Accessories/PS750_Thumbnail.jpg"> <P><A href="/Powerspot-750/">Powerspot 750</A><BR>Codice PS750</P></DIV><DIV id=ctl00_ctl00_ContentPlaceHolderMain_ContentPlaceHolderMain_uxProductDetail_AccessoriesRepeater_ctl02_AccessoriesPanel><IMG class=float:left; alt=img src="/uploadedImages/Product_Images/Lighting/Powerspot800_Thumbnail.jpg"> <P><A href="/Powerspot-800/">Powerspot 800</A><BR>Codice PS800</P></DIV></DIV></DIV></DIV></DIV><!-- TabContainer ends  --><P class=clear>&nbsp;</P></DIV><!-- end main content -->

 

Thank you for your help !

Share this post


Link to post
Share on other sites



There is one level more in the href's in the 2nd file
I suggest this to avoid this kind of trouble

$Array = StringRegExp($HTML, '(?i)"(/uploadedFiles/[^"]+\.pdf)"', 1, $Offset)

 

Share this post


Link to post
Share on other sites

3 hours with multiple tests and I didn't find !!

Thanks a lot !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0