Friday, June 12, 2009

Chapter 3-Lesson 1

  • Regex class is used to match a string against a Regular Expression.
  • When validating input, one must put the leading carat ( ^ ) to represent beginning of input and dollar ($) sign to represent end of input pattern so as to minimize the risk of human error.
  • The carat (^) would match the expression at the beginning of any line in a multi-line string.
  • Regular Expressions characters are case sensitive, even in VB.NET
  • Tip: Use Verbatim strings (that begin with @ sign) to create regular expressions to avoid problems with back-slashes.
  • Try to learn a few simple Regular Expressions for exam.
  • Asterisk (*) means the preceding character must be present zero or more time, while plus (+) sign represents 1 or more times.
  • To define a certain number of occurrence for a character use {n} notation after the character where n is the number of occurrences.
  • We can also define min-max range for a character using {min,max} notation. We can also leave either as blank.
  • Use question mark to make character optional. And Period (.) to represent reserved space for a single character.
  • Use Table 3-3 in the MS Press book for further information.
  • We may use Back-Referencing (using \k with a named group) to search for repeating characters or groups of characters.
  • Use of RegexOptions.ECMAScript with any other options throws an Exception.

No comments:

Post a Comment