Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

StringRegExp capture multiple strings between 2 constants

$
0
0
Hi everyone :)

I trying for more than a hour to get this regular expression right, what I want to do is grab multiple strings inside a table/div on a webpage the problem is to put this to check multiple times for the expressions to capture between (in the example " and "</table")

In this example I'm trying to get all the topic names listed on first page of "General Help and Support" from Autoit forum's but limiting the search/capture between '<table class="ipb_table topic_list hover_rows " summary="Topics In This Forum "General Help and Support"" id="forum_table">' and '</table>'

(I don't know how to paste this tidy, if some one experienced in the mater can share the secret I'll be grateful :) )
[ autoit ]      
#include <Array.au3> $pg = InetRead("http://www.autoitscript.com/forum/forum/2-general-help-and-support/",1) If $pg <> '' Then $exp = '(?i)<table class="ipb_table topic_list hover_rows " summary="Topics In This Forum "General Help and Support"" id="forum_table">.*?'& _ '(?:<a itemprop="url" id=".*?" href=".*?" title="(.*?) - started .*?" class="topic_title">)*?.*?</table>' $aTopics = StringRegExp(BinaryToString($pg),String($exp),3) ConsoleWrite(@error&@LF) _ArrayDisplay($aTopics) Else ConsoleWrite("Cannot DL the page"&@LF) EndIf Exit

EDIT: Code updated, forgot to add 'BinaryToString' to $pg var

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>