faustf Posted March 10, 2015 Share Posted March 10, 2015 hi guy i try to learn regrexp i use regexbuddy i want take a part of this code <div class="contList" abp="100"> <ul class="unstyled" id="categoryList" abp="101"> <li class="btn btn-small gradient eleCat" abp="102"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0" abp="103">CD PLAYERS</a></li> <li class="btn btn-small gradient eleCat" abp="104"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6" abp="105">CD RECORDERS</a></li> <li class="btn btn-small gradient eleCat" abp="106"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4" abp="107">CD/CASSETTE PLAYERS</a></li> i try to use this expression for take '(?i)abp=".+?"><a\n href="(*.?)"' but tell me RegexBuddy does not yet support backtracking control verbs and in autoit not run some on can help me ?? thankz at all for patient Link to comment Share on other sites More sharing options...
faustf Posted March 10, 2015 Author Share Posted March 10, 2015 i answer me probably with this is correct '(?i)abp=".+?2"><a\n href=".*"' Link to comment Share on other sites More sharing options...
jguinch Posted March 10, 2015 Share Posted March 10, 2015 (edited) I don't really understand what is the expected result... Try this : $aResult1 = StringRegExp($sHTML, '(?is)abp="(\d+)"><a\s+href="([^"]+)"', 3) _ArrayDisplay($aResult1) $aResult1 = StringRegExp($sHTML, '(?is)<a\s+href="([^"]+).+?abp="(\d+)"', 3) _ArrayDisplay($aResult1) Edited March 10, 2015 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
faustf Posted March 10, 2015 Author Share Posted March 10, 2015 i trye d to take cd-palyers cd recorders .... i try to use this in regexbuddy is ok but in autoit not go why §??? where is the problem?? (?i)FAmiglia=.+?"\n abp=".+?">(.*?)</a></li> Link to comment Share on other sites More sharing options...
iamtheky Posted March 10, 2015 Share Posted March 10, 2015 is this close, i still dont really understand the goal. But i am guessing its one of these two things. #include<array.au3> $sFile = fileread("file.txt") $sFile = stringstripws($sFile, 8) $aMatches = stringregexp( $sFile , 'href=(.*?)abp="\d+">(.*?)</a></li>' , 3) _ArrayDisplay($aMatches) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jguinch Posted March 10, 2015 Share Posted March 10, 2015 Please, next time post your AutoIt code, even if it doesn't work Your expression could be : StringRegExp($sHtml, '(?i)FAmiglia=.+?"\s+abp=".+?">(.*?)<\/a><\/li>', 3) Or StringRegExp($sHtml, "(?s)<a\s.*?>([^<]+)", 3) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
jdelaney Posted March 10, 2015 Share Posted March 10, 2015 A non-regexp route: $sXML = '<div class="contList" abp="100"><ul class="unstyled" id="categoryList" abp="101"><li class="btn btn-small gradient eleCat" abp="102"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0" abp="103">CD PLAYERS</a></li> <li class="btn btn-small gradient eleCat" abp="104"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6" abp="105">CD RECORDERS</a></li> <li class="btn btn-small gradient eleCat" abp="106"><a href="/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4" abp="107">CD/CASSETTE PLAYERS</a></li></ul></div>' $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadxml($sXML) $oLinks = $oXML.selectNodes("//ul/li/a") For $oLink in $oLinks $sHref = $oLink.getattribute("href") $sAbp = $oLink.getattribute("abp") ConsoleWrite("$sHref=[" & $sHref & "]; $sAbp=[" & $sAbp & "]" & @CRLF) Next output: $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE0]; $sAbp=[103] $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE6]; $sAbp=[105] $sHref=[/b2b/Ricerche/FantaRicerca/MostraFiltri?catMerc=HE&codFamiglia=HE4]; $sAbp=[107] jguinch 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jguinch Posted March 10, 2015 Share Posted March 10, 2015 @jdelaney : nice ! It's not the first time I see you use XMLDOM for this kind of request. I should learn to use it, it seems powerful ! Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
jdelaney Posted March 10, 2015 Share Posted March 10, 2015 (edited) It works on xml, but not generally on full html source. Html is similar, but not an exact match. For snippets like this, it's good to go. Edited March 10, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
faustf Posted March 10, 2015 Author Share Posted March 10, 2015 woow genius Link to comment Share on other sites More sharing options...
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