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

Regex in Framework 1.1 help

Hi,
Can someone please test the regex below in .NET Framework 1.1 and let me
know the results.

Running in 2.0, it does not capture the line number if there are any
nonmatching line numbers (such as the second line).

TIA

JB

string pattern = @"^\ *at\ (?:(?:(?<target>.+?)\x3Aline\
(?<line>\d+))|(?<target>.*))\w*$";
Regex regex = new Regex(pattern, RegexOptions.Compiled |
RegexOptions.IgnoreCase | RegexOptions.Multiline |
RegexOptions.IgnorePatternWhitespace);

MatchCollection matches = regex.Matches(@"
at fubar1():line 200
at fubar2()
");

foreach (Match match in matches)
{
Console.WriteLine("target found: {0}",
match.Groups["target"].Success);
Console.WriteLine("target was: {0}",
match.Groups["target"].Value);
Console.WriteLine("line found: {0}",
match.Groups["line"].Success);
Console.WriteLine("line was: {0}",
match.Groups["line"].Value);
}
Oct 17 '07 #1
0 1040

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

Similar topics

5
by: Ali Eghtebas | last post by:
Hi, I've made this regex to catch the start of a valid multiline comment such as "/*" in e.g. T-SQL code. "(?<=^(?:*'*')*?*)(?<!^(?:*'*')*?--.*)/\*.*?$" With Multiline option on. As we know...
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...
16
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at...
6
by: BigAl | last post by:
Perhaps someone here can help me out... RegEx: "^.*\d{5}(-\d{4})?.*$" Intended Purpose: To strip out the City/State/ZipCode line from a signature. Sample Text: Joe Jackson 131 W. 5th...
3
by: Francesco | last post by:
Hi to all, someone of you has a regular expression for image file in Asp.NET C# ? Thanks Francesco
4
by: | last post by:
Here is an interesting one. Running asp.net 2.0 beta 2. I have a regular expression used in a regex validator that works on the client side in Firefox but not in IE. Any ideas? IE always reports...
3
by: circuit_breaker | last post by:
Hi, I'm trying to build a Regex expression that will extract the variable name from a COBOL layout. As an example, the Regex expression would operate as follows: 05 WS-MANUF-NAME-LEVEL2 PIC...
1
by: Bryan Young | last post by:
I want to generate a usable filename (no path, drive letter, or extension) from strings from various sources (dates, database fields, user entry, etc). I'm trying to use the following line and...
4
by: Henrik Dahl | last post by:
Hello! In my application I have a need for using a regular expression now and then. Often the same regular expression must be used multiple times. For performance reasons I use the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
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,...

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.