faustf Posted January 29, 2015 Posted January 29, 2015 hi guy i have this web page i attacched and use this code Local $aArray_Descrizione_prodotti = StringRegExp($sText, '(?i)<div class="mostro" abp=".+?">\h*([^<]+)</strong> </div>', $STR_REGEXPARRAYGLOBALMATCH) ; descrizione breve descrizione-short.html
mikell Posted January 29, 2015 Posted January 29, 2015 Please post a runnable code and an example of expected result
faustf Posted January 29, 2015 Author Posted January 29, 2015 ; Script Start - Add your code below here #include <IE.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <InetConstants.au3> #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <INet.au3> #include <Excel.au3> #include <File.au3> $sHTML_1_level = ("E:\_GROSSITI-GRAB\Espri_temp\descrizione-short.html") $aArray = StringRegExp($sHTML_1_level, "btn btn-small gradient eleCat.+?<a[^>]+>\h*([^<]+)</a>", 3) For $i_CodP = 0 To UBound($aArray) - 1 MsgBox(0,'',$aArray[$i_CodP]) Next
GMK Posted January 29, 2015 Posted January 29, 2015 Well, doing a quick search of your attached file, the word eleCat appears nowhere in the file. So it couldn't find it even if you had loaded the file into a variable properly. That's the bigger problem--you need to use FileRead to load the file into the variable first.
faustf Posted January 29, 2015 Author Posted January 29, 2015 (edited) o sorry i copy not good line Local $aArray_Descrizione_prodotti = StringRegExp($sText, '(?i)<div class="mostro" abp=".+?">\h*([^<]+)</strong> </div>', $STR_REGEXPARRAYGLOBALMATCH) ; descrizione breve this is a correct , but not go Edited January 29, 2015 by faustf
mikell Posted January 29, 2015 Posted January 29, 2015 Nice. And what about an example of expected result ?
faustf Posted January 29, 2015 Author Posted January 29, 2015 i want if possible (not only one ) Utilizzo: <strong abp="291">Home music</strong> Potenza output per canale: <strong abp="292">140 W</strong> Colore primario: <strong abp="293">Nero</strong> Potenza W RMS : <strong abp="294">140 W</strong> Impedenza: <strong abp="295">4 Ohm</strong> N° Canali: <strong abp="296">2</strong> Collegamento iPod: <strong abp="297">No</strong> </div> without html code
mikell Posted January 29, 2015 Posted January 29, 2015 (edited) Something like this then... But all this seems really hazardous $sText = FileRead("descrizione-short.html") Local $res = StringRegExp($sText, '(?is)<div class="mostro" abp="\d+">\s*(.*?)</strong> \h*</div>', 3) ; descrizione breve _ArrayDisplay($res) For $i = 0 to UBound($res)-1 $str = StringRegExpReplace($res[$i], '<strong.*?>', "") $str = StringRegExpReplace($str, '</strong> ', @crlf) Msgbox(0,"", $str) Next Edited January 29, 2015 by mikell faustf 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now