.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Why does this match?

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
Hi,               I am not good with Regular Expressions. I recently attempted the following:   static void Main(string[] args) { const string NEXT_PATTERN = "<a href=\\\"(?<NextLink>.+?)\\\">Next Page</a></span>"; const string content = "SomeText <a href=\"LinkToExtract\">Next Page</a></span> SomeText"; MatchCollection matches = Regex.Matches(content, NEXT_PATTERN); Console.WriteLine("Match Count = " + matches.Count); Match m = matches[0]; string nextLink = m.Groups["NextLink"].Value; Console.WriteLine("Next Link = " + nextLink); }       I think this should not match i.e. NEXT_PATTERN seems to have a Back Slash \ after the href and before the end – while the content does not. I am really curious why this matches – and how to exclude this case.   Thanks a lot, O.O.

View Complete Post

More Related Resource Links

The number of members in the conceptual type ... does not match with the number of members on the ob



I've added a scalar property to an entity and now ASP.NET Dynamic Data scaffolding throws this error:

The number of members in the conceptual type 'TrainingModel.Users' does not match with the number of members on the object side type 'TrainingModel.Users'. Make sure the number of members are the same.

This happens at the following line in global.asax:
model.RegisterContext(typeof(TrainingModel.TrainingEntities), new ContextConfiguration() { ScaffoldAllTables = true });

Please help!

Advanced Basics: A Match-Making Game in Visual Basic


My four-year-old son has decided that he wants to be like his dad when he grows up. He is planning to work in my office, and write computer programs just like I do. But there is one problem-he thinks I write games.

Duncan Mackenzie

MSDN Magazine October 2005

The XML Files: XSLT Keys, Select vs. Match, Conflict Resolution, and More


This month Aaron Skonnard covers how keys work in XSLT, XSLT match and select attributes, SelectNodes order, finding