473,419 Members | 1,983 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,419 software developers and data experts.

Regular Experssion Question

I'm trying to understand how to parse text that contains line breaks.
Below I have some html code that I'm trying to parse using a regular
expression. The problem is that my expression works on all tags
[<span></span>] that do not include linebreaks.

I wrote this regular expersion that is almost perfect.
"<span\sclass="tableListing-*.*</span>"

Results of regex:

<span class="tableListing-date">Tue, 11/08/05<br>03:00 PM</span>
<span class="tableListing-act">Nine Inch Nails</span>
<span class="tableListing-venue"><a href="/venue/8337">TD Banknorth
Garden (formerly Fleetcenter)</a> Boston, MA</span>
<span class="tableListing-date">Tue, 11/08/05<br>07:00 PM</span>

but.... I'm missing this line...:

<span class="tableListing-info">
<a
href="http://www.ticketmaster.com/event/01003AEF87773082?artistid=735762&majorcatid=10001& minorcatid=60"
class="findTickets">Find Tickets</a>on sale now
</span>
<----Missing end>

</
Here is the raw code:
<tr>
<td class="left">
<span class="tableListing-date">Tue, 11/08/05<br>07:00
PM</span></td>
<td class="center">
<span class="tableListing-act">Nine Inch
Nails</span></td>
<td class="center">
<span class="tableListing-venue"><a
href="/venue/8337">TD Banknorth Garden (formerly Fleetcenter)</a>
Boston, MA</span></td>
<td class="right" nowrap="nowrap">
<span class="tableListing-info">
<a
href="http://www.ticketmaster.com/event/01003AEF87773082?artistid=735762&majorcatid=10001& minorcatid=60"
class="findTickets">Find Tickets</a>on sale now
</span></td>
</tr>

Nov 23 '05 #1
1 1175
Maybe
"yourOptions or RegexOptions.Multiline" is what you are missing?
"pmclinn" <pm*****@gmail.com> schrieb im Newsbeitrag
news:11*********************@f14g2000cwb.googlegro ups.com...
I'm trying to understand how to parse text that contains line breaks.
Below I have some html code that I'm trying to parse using a regular
expression. The problem is that my expression works on all tags
[<span></span>] that do not include linebreaks.

I wrote this regular expersion that is almost perfect.
"<span\sclass="tableListing-*.*</span>"

Results of regex:

<span class="tableListing-date">Tue, 11/08/05<br>03:00 PM</span>
<span class="tableListing-act">Nine Inch Nails</span>
<span class="tableListing-venue"><a href="/venue/8337">TD Banknorth
Garden (formerly Fleetcenter)</a> Boston, MA</span>
<span class="tableListing-date">Tue, 11/08/05<br>07:00 PM</span>

but.... I'm missing this line...:

<span class="tableListing-info">
<a
href="http://www.ticketmaster.com/event/01003AEF87773082?artistid=735762&majorcatid=10001& minorcatid=60"
class="findTickets">Find Tickets</a>on sale now
</span>
<----Missing end>

</
Here is the raw code:
<tr>
<td class="left">
<span class="tableListing-date">Tue, 11/08/05<br>07:00
PM</span></td>
<td class="center">
<span class="tableListing-act">Nine Inch
Nails</span></td>
<td class="center">
<span class="tableListing-venue"><a
href="/venue/8337">TD Banknorth Garden (formerly Fleetcenter)</a>
Boston, MA</span></td>
<td class="right" nowrap="nowrap">
<span class="tableListing-info">
<a
href="http://www.ticketmaster.com/event/01003AEF87773082?artistid=735762&majorcatid=10001& minorcatid=60"
class="findTickets">Find Tickets</a>on sale now
</span></td>
</tr>

Nov 23 '05 #2

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

Similar topics

20
by: Toby | last post by:
Could some tell how I could create a search replace Regular Express in .net where is would match MY_STRING_TO_BE_CONVERTED and replace with MyStringToBeConverted
7
by: Patient Guy | last post by:
Coding patterns for regular expressions is completely unintuitive, as far as I can see. I have been trying to write script that produces an array of attribute components within an HTML element. ...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
5
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
6
by: Teja | last post by:
HI all, I need to write a regular experssion for a string which satisfies the following a criteria : 1) it should start with an alphabet 2) it can contain alphabets/digits/_ from second...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.