By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Regular Expression's Problem

P: n/a
Hi All,

I am learning Regular Expression and currently i am trying to capture
information from web page.
I wrote the following code to capture the ID as well as the Title

Dim regex = New Regex( _
"viewtopic.php\?t=(?<ID>\d+)""\sclass=""topictitle "">(?<Title>.*)\</a>",
_
RegexOptions.IgnoreCase _
Or RegexOptions.Multiline _
Or RegexOptions.Compiled _
)

It works fine
Now i am trying to get the post date by using the following regex
"s=""postdetails"">(?<Date>.*)\<br />"

It works fine too, but when i combine the two reg ex together (That is
"viewtopic.php\?t=(?<ID>\d+)""\sclass=""topictitle "">(?<Title>.*)\</a>.*s=""
postdetails"">(?<Date>.*)\<br />"", it cannot got the correct data, could
anyone know how can i fix this? whatz wrong on my regex?

Thx a lot
Regards,
Norton
(Here is the source text for reg exp to take place, the ID i want to capture
is 245090, title is "Can someone help me import a database" and the date is
Wed Dec 08, 2004 6:31 pm)

<tr>
<td class="row1" align="center" valign="middle" width="20"><img
src="templates/subSilver/images/folder.gif" width="19" height="18" alt="No
new posts" title="No new posts" /></td>
<td class="row1" width="100%"><span class="topictitle"><a
href="viewtopic.php?t=245090" class="topictitle">Can someone help me import
a database</a></span><span class="gensmall"><br />
</span></td>
<td class="row2" align="center" valign="middle"><span
class="postdetails">2</span></td>
<td class="row3" align="center" valign="middle"><span class="name"><a
href="profile.php?mode=viewprofile&amp;u=154279">s avethesquirrels</a></span>
</td>
<td class="row2" align="center" valign="middle"><span
class="postdetails">126</span></td>
<td class="row3Right" align="center" valign="middle"
nowrap="nowrap"><span class="postdetails">Wed Dec 08, 2004 6:31 pm<br /><a
href="profile.php?mode=viewprofile&amp;u=154279">s avethesquirrels</a> <a
href="viewtopic.php?p=1344942#1344942"><img
src="templates/subSilver/images/icon_latest_reply.gif" alt="View latest
post" title="View latest post" border="0" /></a></span></td>
</tr>

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.