1

Despite my many efforts to learn RegEx, I find this quite hard todo, so I'm asking the community for help.

So, I have this string:

<html><head>
<title>Test</title>
</head>
<body>
<a href="goforward?U=as4395897a8druasfdas833a">Go</a>
</body>
</html>

Now I want to find as4395897a8druasfdas833a using a regex. This code is not inside an "" in the real word, although I would like to search for "goforward?U" (that one is always the same).

Thanks in advance.

2
  • 1
    That looks like HTML. It might be better to use an HTML parser. Commented Mar 14, 2011 at 23:20
  • Further to Mark Byers's remark, see stackoverflow.com/questions/1732348/… . Commented Mar 14, 2011 at 23:22

3 Answers 3

6

In your example code, this would work:

goforward\?U=(\w+)

But more information is needed to get it more precise. Since I don't know what "actually" contains or what ends the term you want to find I can't give an exact regular expression so if you comment with more details I can tweak it.

Sign up to request clarification or add additional context in comments.

Comments

4

This should work:

goforward\?U=[a-z0-9]+

3 Comments

You plagiarized me AND vbence. ;-)
Nah, I just posted later than you. Plus when I tested yours the () were screwing me up. C'mon, don't bust my chops here, my rep is still low ; ]
Fun to be back in the kindergarten :).
2

Try with this:

goforward\?U=([a-z0-9]+)

1 Comment

I'm a dirty thief on intellectual property :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.