473,405 Members | 2,354 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.

How to math multiline using C#?

Hi,

I met a question when I would match some lines using the pattern
"<td>(.*?)</td>" in flows :
===============
<td>Hi
hello world!
....
</td>
===============

The question is I'll match these lines between "<td>" and "</td>", but
can't math anything using this pattern.

Here is my code:
===============
using System.Text.RegularExpressions;
Regex r;
Match m;
r = new Regex("<td>(.*?)</td>",
RegexOptions.IgnoreCase|RegexOptions.Compiled|Rege xOptions.Multiline);
for (m = r.Match(pageContent); m.Success; m = m.NextMatch()) {
if(m.Groups[1].ToString()!="")
System.Console.Out.WriteLine(m.Groups[1].ToString());
}
===============

Who can help me?

Thanks in advance,
Jason.Lee

Aug 12 '06 #1
1 1641
I got it! Please replace the pattern as "(?<InnerText>[\s\S]*?)"
string result = m.Groups["InnerText"].Value;

sh*********@gmail.com wrote:
Hi,

I met a question when I would match some lines using the pattern
"<td>(.*?)</td>" in flows :
===============
<td>Hi
hello world!
...
</td>
===============

The question is I'll match these lines between "<td>" and "</td>", but
can't math anything using this pattern.

Here is my code:
===============
using System.Text.RegularExpressions;
Regex r;
Match m;
r = new Regex("<td>(.*?)</td>",
RegexOptions.IgnoreCase|RegexOptions.Compiled|Rege xOptions.Multiline);
for (m = r.Match(pageContent); m.Success; m = m.NextMatch()) {
if(m.Groups[1].ToString()!="")
System.Console.Out.WriteLine(m.Groups[1].ToString());
}
===============

Who can help me?

Thanks in advance,
Jason.Lee
Aug 12 '06 #2

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

Similar topics

0
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
0
by: Justin | last post by:
Hi, First off, I must apologise for cross posting. I am having difficulty creating a pdf document using perl cgi to do substitution for multiline pdf form fields. I created a pdf template/file...
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
2
by: Chris | last post by:
Hi We are using style sheets to set the font of our labels and text boxes. This has been working great until we required a text box with a textmode of Multiline. The control picks up the...
40
by: Edward Elliott | last post by:
At the risk of flogging a dead horse, I'm wondering why Python doesn't have any multiline comments. One can abuse triple-quotes for that purpose, but that's obviously not what it's for and doesn't...
4
by: ramesh_tankala | last post by:
Hi,,,friends.. i am using multiline text box for storing address ,suppose my multiline control(address) is 2nd one,suppose i move from 1st control to 2nd(address) my cursor placed in begining of...
2
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to...
6
by: Zdenek Maxa | last post by:
Hi all, I would like to perform regular expression replace (e.g. removing everything from within tags in a XML file) with multiple-line pattern. How can I do this? where =...
4
by: T | last post by:
hi, Just wondering what tools are available for authoring in XML for docs that have complex math environments. Like equation arrays, multiline equations, etc. The kind of environments AMSLaTeX...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.