Regex 101 Discussion I7 - Make sure all characters inside <> are uppercase

Posted by: Eric Gunnersons C# Compendium, on 10 Feb 2006 | View original | Bookmarked: 0 time(s)

Regex 101 Exercise I7 - Make sure all characters inside <> are uppercase

First, as Sheva pointed out, making them all *lowercase* would make a lot more sense, but you have probably noticed that the correlation between these exercises and making sense is tenuous at best.

This is another case where that MatchEvaluator functionality is so useful. To match inside the <>, we simply use:

<.*?>

(Extra Credit: Discuss why the "?" is required, what other options are available, and the relation between the different match options and Adam Smith's market theories.)

Then, our MatchEvaluator is as follows:

static public string Evaluator(Match match)

      return match.Groups[0].Value.ToUpper();
}

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: Regex | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 680 | Hits: 86

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD