Jump to content

StringRegExp where is my error ?


faustf
 Share

Recommended Posts

; 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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 i want if  possible  (not  only  one )

Utilizzo: <strong abp="291">Home music</strong>&nbsp;Potenza output per canale: <strong abp="292">140 W</strong>&nbsp;Colore primario: <strong abp="293">Nero</strong>&nbsp;Potenza W RMS : <strong abp="294">140 W</strong>&nbsp;Impedenza: <strong abp="295">4 Ohm</strong>&nbsp;N° Canali: <strong abp="296">2</strong>&nbsp;Collegamento iPod: <strong abp="297">No</strong>&nbsp;                    </div>

without  html code :)

Link to comment
Share on other sites

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>&nbsp;\h*</div>', 3) ; descrizione breve

 _ArrayDisplay($res)

For $i = 0 to UBound($res)-1
   $str = StringRegExpReplace($res[$i], '<strong.*?>', "")
   $str = StringRegExpReplace($str, '</strong>&nbsp;', @crlf)
   Msgbox(0,"", $str)
Next
Edited by mikell
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...