Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


Using Regular Expressions Metacharacters with .net – Anchors and Other Zero-Width Assertions


Using Regular Expressions Metacharacters with .net – Anchors and Other "Zero-Width Assertions"

Anchors and other "zero-width assertions" don’t match actual text, but rather positions in the text.

^, \A

Caret (^) matches at the beginning of the text being searched, and, if in an enhanced line-anchor match mode, after any newline. In some systems, an enhanced-mode ^ can match after Unicode line terminators, as well. While \A always matches only at the start of the text being searched, regardless of any match mode.

$, \Z, \z

Dollar ($) matches at the end of the target string, and before a string-ending newline, as well. \Z usually matches the end of the string, or before a string-ending newline. To complement these, \Z matches only at the end of the string, period, without regard to any newline.

\G

\G was first introduced by Perl to be useful when doing iterative matching with /g, and ostensibly matches the location where the previous match left off. On the first iteration, \G matches only at the beginning of the string, just like \A.

Word boundaries – \b, \B, \<, \>

Like line anchors, word-boundary anchors match a location in the string. There are two distinct approaches. One provides separate metasequences for start- and end of-word boundaries (often \< and \>), while the other provides ones catch-all word boundary metasequence (often \b). Either generally provides a not-word boundary metasequence as well (often \B).

Lookarounds – (?=exp), (?<=exp), (?!exp), (?<!exp)

Read more about Lookahead and Lookbehind Zero-Width Assertions.

Chetan love blogging. He regularly blogs at http://www.tipsntracks.com. You can connect with Chetan on Twitter, Facebook and Google Plus...

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

[...] Using Regular Expressions Metacharacters with .net – Anchors and Other Zero-Width Assertions [...]

Pingback by Text and Data Manipulation with Regular Expressions in .NET Development | Tips n Tracks on June 1, 2009 @ 10:55 am

Leave a comment

(required)

(required)

*
To prove that you're not a bot, enter this code
Anti-Spam Image