I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx

simpleonline1234

Junior Member
Joined
Jan 26, 2010
Messages
170
Reaction score
13
I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx and I've tested out about 5 different RegEx "builders" but each of them require you to navigate through the options to build the Regex...each of them has failed when I try to use them.

Is there an application out there free/paid where you select the line you want to grab and the RegEx is auto generated from that hightlight rather than having to try to build the line of code?

What I want to grab is this line of code:

Code:
 <script type="text/javascript" src="[URL="http://www.blackhatworld.com/blackhat-seo/view-source:http://www.google.com/recaptcha/api/challenge?k=6LemUQQAAAAAAC6mNwmiXb8ZwmUU0R9Z5v_yZ5xl"]http://www.google.com/recaptcha/api/challenge?k=6LemUQQAAAAAAC6mNwmiXb8ZwmUU0R9Z5v_yZ5xl[/URL]">

Of course this line changes since it's a captcha so I only need to grab the link up to the k?= location.

I can do this using the web browser control but I'm attempting to speed things up by using a webrequest.

Any ideas on the RegEx software or how to grab this exact line?

Thanks

EDIT: Might help if you see my code as well so here goes it:

[CODE]       Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://hubpages.com/user/new/")
        Dim response As System.Net.HttpWebResponse = request.GetResponse
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream)
        Dim rssourcecode As String = sr.ReadToEnd

        '("src=([""'])(.*?)\1") 
        '<script type=""text/javascript"" src=""http://www.google.com/recaptcha/api/challenge?k=.*/"">
        Dim r As New System.Text.RegularExpressions.Regex("<script[\s\S]*?/script>")
        Dim matches As MatchCollection = r.Matches(rssourcecode)
        For Each itemcode As Match In matches
            TextBox1.Text = TextBox1.Text & itemcode.Value & vbNewLine
        Next

[/CODE]
 
Back
Top