Solved

regular expression to return specified colums values

Posted on 2008-06-18
6
155 Views
Last Modified: 2013-11-26
i have this body of html text, bellow in snipt code, i need by using regular expression in .net to get this values of :
1.applicant name
2.badge number
3.network account
4.departement name
5.cost center
6. extention
7.bleeb
8.email

regares
<style>
body{FONT-FAMILY: Times New Roman,sans-serif;FONT-SIZE: 0.8em;}
</style>
<table cellSpacing=0 cellPadding=4 width=90% border=0>
<tr>
<td>Dear Helpdesk Agent,
<br>
<br>Please escalate the FAX user request below to FAX administrator in your site.
<br>
<br>User Details:
</td>
 
</tr>
</table>
<table cellSpacing=0 cellPadding=4 width=70% border=1 bordercolor=#ffefd5>
<tr>
<td>
 
<table width=100% cellSpacing=4 cellPadding=2 border=0>
<tr>
<td width=50% bgcolor='#f8f8ff'>Applicant name
</td>
<td width=50%>Medical Education
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Badge No. or Department Network Account
</td>
<td width=50%>mededu1@ngha.med.sa
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Network Account
</td>
<td width=50%>NGHA
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Department Name
</td>
<td width=50%>Postgraduate Education 
& Academic Affairs
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Cost Centre Code
</td>
<td width=50%>9667
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Extesnsion
</td>
<td width=50%>13364
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Bleep
</td>
<td width=50%>3364
</td>
 
</tr>
<tr>
<td width=50% bgcolor='#f8f8ff'>Email
</td>
<td width=50%>jebrens@ngha.med.sa
</td>
 
</tr>
</table>

Open in new window

0
Comment
Question by:baghlaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 21812158
In your example, where would applicant name go? For that one, you have

<tr>
<td width=50% bgcolor='#f8f8ff'>Applicant name
</td>
<td width=50%>Medical Education
</td>

While the rest of them are formatted differently.

In any event, you would want something like this (in VB)

Dim pattern As String = "<td width=50% bgcolor='#f8f8ff'>Bleep\n</td>\n<td width=50%>(\d+)\n</td>"
dim bleep as string = Regex.Match( HTMLstring, pattern ).Groups(0).ToString() )

and repeat for each item you want.




0
 

Author Comment

by:baghlaf
ID: 21812208
i need for exampel, for applicant name to return in my example ""Medical Eduction'" and for Bleep i return 3364, and so on for other values,

regards.
0
 

Author Comment

by:baghlaf
ID: 21836810
okay,
i have solved the problem which is:
<td width=50%>(?<Name>.*?)\<

this pattern go okay for my issue..

regards.
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 21846989
ok, but I did provide a solution.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question