|
-
Sep 12th, 2007, 12:19 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [02/03] Regex Problem : URGENT
Hi all,
I need urgent help regarding Regular Expression.
I m retieving whole page as HTML codes.
Now i want to retrieve code inside any perticular HTML tag like tr/div according to it's id.
I want to make use of regular expression but some how im not getting right result.
Dim reg As New System.Text.RegularExpressions.Regex("<tr id=""xyz""[^>]*>(?<innerValue>([^<].*))</tr>.*", RegexOptions.IgnoreCase Or RegexOptions.Compiled Or RegexOptions.Multiline)
e.g.
<html>
<table ...>
<tr id='xyz' style='....'><td> in XYZ</td> </tr>
<tr id='abc' style='....'><td> in ABC</td></tr>
</table>
</html>
i want inner value of tr e.g. "<td> in XYZ</td>" if id is 'xyz'
"<td> in ABC</td>" if id is 'abc'
I hope u understand.
thanks in advanced
I am using .NET 2010 with Windows 7
-
Sep 12th, 2007, 04:54 PM
#2
Re: [02/03] Regex Problem : URGENT
So if you use:
<tr id="xyz"[^>]*>(?<innerValue>(.*))</tr>.*
You will get
<td> in XYZ</td>
Which should be right since you mentioned "i want to retrieve code inside any perticular HTML tag like tr/div according to it's id."
-
Sep 12th, 2007, 11:41 PM
#3
Thread Starter
Hyperactive Member
Re: [02/03] Regex Problem : URGENT
Sorry, I have already tried it.. it gives
in XYZ</td> </tr><tr id='abc' style='....'><td> in ABC</td>
before the last </tr> value.. how can i find the value before the first occurance of </tr>
Any suggestion..
I am using .NET 2010 with Windows 7
-
Sep 13th, 2007, 04:02 AM
#4
Thread Starter
Hyperactive Member
Re: [02/03] Regex Problem : URGENT
I am using .NET 2010 with Windows 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|