Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 686

RegExp pattern for retrieving data between 2 Tags

$
0
0
Hi :wave:
I need your help about this script.
What I want to do is just get the data between the <title>Data to be extracted</title> and <!-Mfunc->Data to be extracted<!--/mfunc-->
So if someone here is kind enough to correct me the syntax pattern to achieve my goal.
Thank you !
Code:

Dim Titre,URL,ie,objFSO,Data,OutPut,objRegex,Match,Matches
    Titre = "Notification de Giveawayoftheday © Hackoo © 2013"
    URL = "http://fr.giveawayoftheday.com/"
    Set ie = CreateObject("InternetExplorer.Application")
    Set Ws = CreateObject("wscript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ie.Navigate (URL)
    ie.Visible=false
    DO WHILE ie.busy
        wscript.sleep 100
    LOOP
    Data = ie.document.documentElement.innerHTML
    ie.Quit
    Question = MsgBox(RegExp("<title>(.*?)</title>")&vbcr&vbcr&_
    " Le temps restant est :" &vbcr&vbcr&_
    RegExp("<!--mfunc-->(.*?)<!--/mfunc-->")&vbcr&vbcr&_
    "Voulez-vous accéder au site : http://fr.giveawayoftheday.com/  ?",VBYesNO+VbQuestion,Titre)
    If Question = VbYes then
        Ws.Run "http://fr.giveawayoftheday.com/",1,False
    else
        Wscript.Quit
    end if
    Set ie = Nothing
   
Function RegExp(Motif)   
Set objRegex = new RegExp
objRegex.Pattern = Motif 'Motif pour y extraire le code source
objRegex.Global = False 'une seule instance
objRegex.IgnoreCase = True 'Ignorer la casse
Set Matches = objRegex.Execute(Data) 'Execution du la RegExp
For Each Match in Matches 
    strMatchValue = Match.Value
    RegExp = strMatchValue
Next
End Function


Viewing all articles
Browse latest Browse all 686

Trending Articles



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