Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
590
|
Chapter 10: Regular Expressions
of a UNC string. By breaking up the regular expression onto separate lines and add-
ing comments to each line, you have allowed other developers (who might not be
familiar with regular expressions) to more quickly and easily read and maintain your
regular expression.
Typically, you would use the string concatenation and C#-style commenting to com-
ment a regular expression string. However, if you are retrieving the regular expres-
sion from an external source, such as a text file, regular expression–style
commenting (#) is the type to use.
With simpler regular expressions, you can get away with adding a C# comment out-
side of the regular expression string to indicate what it does. But adding comments
to the regular expression itself greatly aids in understanding it.
10.14 Using Built-in Regular Expressions to Parse
ASP.NET Pages
Problem
You need to build a tool that parses ASP.NET pages in order to extract specific bits
of information. This tool could possibly be used to detect whether specific meta tags
are being used or if there are any comments that could expose information useful to
a hacker.
Solution
Use the classes in the System.Web.RegularExpressions namespace. In this recipe you will
focus on mapping out the start and end tags on a page, as shown ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Joe Mayo
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata