Going nuts- Is there a Regex builder that actually BUILDS your RegEx from a highlight

simpleonline12

New member
Sep 29, 2009
191
3
0
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.wickedfire.com/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]
 


Why aren't you using xpath yet?

The solution to not knowing regex is to learn regex more, not to rely on software.
 
Because I'm a dumb ass and will just keep staring at my screen until I figure it out. I know I really do need to move over to xml but because I've put in 3 days straight to figure out this puzzle and I'm at the last little end of it so for me to walk away from it now over whelms to have to start all over. But being new to programming I've chased something down only to find a dead end so I guess I'm just going to have to deal.

Thanks again for the advice on XMl...Switching now.!!
 
Because I'm a dumb ass and will just keep staring at my screen until I figure it out. I know I really do need to move over to xml but because I've put in 3 days straight to figure out this puzzle and I'm at the last little end of it so for me to walk away from it now over whelms to have to start all over. But being new to programming I've chased something down only to find a dead end so I guess I'm just going to have to deal.

Thanks again for the advice on XMl...Switching now.!!

xpath != xml
 
Works awesome...thanks guys....yeah I'm going to start up with Xpath...my initial approach was web browsers...worked okay but when you have 40 webbrowsers or 40 tags going at once it's slower than Christmas....then I started up with sockets and realized that was like going hunting with a bazooka...web request seems to be right up my alley...now I just have to learn how to work with the data so I started up with Regex...I'm glad there is an alternative to Regex because trying to understand that mini language is like trying to read Chinese when your blind and half deaf.

Thanks again guys..
 
I envy you guys that have kept up with the different programming languages. I haven't written code since QuickBasic back in the DOS days. I had fun with it but over the years I kinda got away from writing programs.

I did dabble a bit with Fortran, Cobol, and Pascal. Never got very accomplished with them though. Fortran and Cobol were a bit to obtuse for my tastes.
 
I envy you guys that have kept up with the different programming languages. I haven't written code since QuickBasic back in the DOS days. I had fun with it but over the years I kinda got away from writing programs.

I did dabble a bit with Fortran, Cobol, and Pascal. Never got very accomplished with them though. Fortran and Cobol were a bit to obtuse for my tastes.

I wrote a breakout clone in quickbasic when I was like 9, shit was awesome, I wish I still had the code for it so I could run it in an emulator.
 
Cool...thanks Jay...will hit them up a bit....it's like a Yahoo Answers for programmers... Nice!!!

Been reading up on XML..damn...where was this 3 months ago??? Loving it now!... <making some crap up> right about now </making some crap up>

Ha!
 
Cool...thanks Jay...will hit them up a bit....it's like a Yahoo Answers for programmers... Nice!!!

Been reading up on XML..damn...where was this 3 months ago??? Loving it now!... <making some crap up> right about now </making some crap up>

Ha!

I still don't think you're quite getting this.

As dchuk said, xPath isn't XML. It can be used with XML, although its more likely you're going to be using it with HTML.
 
Gotcha....thanks Jake...found that you can use Xpath for a lot of stuff.

I attempted to use Firebug but I'm thinking alot of the old school stuff that they have on your add-on site isn't the same on the newer sites.

For instance I don't see the XML or xPath on the plug in anymore. :(

But everything happens for a reason so I'm better off just toughing it out and chase the rabbit hole on xPath to learn the ropes.

I was going to post my bot on there for free that wold grab HTML by location but found out that Firebug handles that as well.

But thanks guys for the help as always...I know you all probably wish you had a "reach and and smack him" button with me sometimes....ha...I'm so freaking hard headed when it comes to learning something that I will keep trying something until it works....sadly enough if I had just read a few more chapters into a book rather than reading a quick tip and thinking I knew it all I would be in a better place.

But see yaw round until my next unbreakable wall appears...or tomorrow which ever comes first!! Ha!

:party-smiley-004:
 
  • Like
Reactions: gutterseo