473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C# Regex Help - should be an easy one

I'm parsing through the HTML for an nba box score looking to pull out
the officials' names, but the regex expression I'm using is pulling
out the officials and all the code after the officials, which I don't
need.

So here's my regex:
"Officials:.*/td>"

and here's the HTML I'm getting back:
"Officials:#24 Mike Callahan, #9 Derrick Stafford,
#54&nbsp;Derrick&nbsp;Collins</td><td
align=\"right\">Attendance:&nbsp;14796</td></tr></table><!-- End Game
Info table --><!-- START Visitor player Stats team table --><table
width.......

This goes on for pages and pages.

I only want from "Officials" to the first "/td>" and I'm pretty sure
it's the * in my regex that's messing it up, but I'm not sure how to
fix it. Any help would be greatly appreciated!!
Nov 16 '05 #1
1 1092

Use the lazy quantifier *? instead of greedy quantifier *

"Officials:.*?/td>"

This will stop at the first occurrence of /td> rather than the last.

Brian Davis
http://www.knowdotnet.com
"Oren Liebermann" <gr****@yahoo.com> wrote in message
news:3d**************************@posting.google.c om...
I'm parsing through the HTML for an nba box score looking to pull out
the officials' names, but the regex expression I'm using is pulling
out the officials and all the code after the officials, which I don't
need.

So here's my regex:
"Officials:.*/td>"

and here's the HTML I'm getting back:
"Officials:#24&nbsp;Mike&nbsp;Callahan, #9&nbsp;Derrick&nbsp;Stafford,
#54&nbsp;Derrick&nbsp;Collins</td><td
align=\"right\">Attendance:&nbsp;14796</td></tr></table><!-- End Game
Info table --><!-- START Visitor player Stats team table --><table
width.......

This goes on for pages and pages.

I only want from "Officials" to the first "/td>" and I'm pretty sure
it's the * in my regex that's messing it up, but I'm not sure how to
fix it. Any help would be greatly appreciated!!

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Johnny | last post by:
I need to determine whether a text box contains a value that does not convert to a decimal. If the value does not convert to a decimal, I want to throw a MessageBox to have the user correct the...
7
by: bill tie | last post by:
I'd appreciate it if you could advise. 1. How do I replace "\" (backslash) with anything? 2. Suppose I want to replace (a) every occurrence of characters "a", "b", "c", "d" with "x", (b)...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
2
by: Good Man | last post by:
Hi there I have a series of HTML tables (well-formed, with elements ID'd quite nicely) and I need to extract the contents from certain TDs. For example, I'd like to get "Hi Mom!" from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.