Search this blog

You can search for all the topics in our blog using our google custom search now.

Search the blog

Loading

Sunday, July 4, 2010

Learning regular expression step by step tutorials: Step 5


Free Microsoft MCTS 70-536 Examination Training and Preparation for Jobs






ANCHORS
First thing to remember is that anchors doesn't match with anything. They are not available  to match with any characters but to specify to match a position before,between or after characters.They are called anchors since they provide the information of a position of match to be checked. Start of a string anchor is denoted by caret(^) symbol and End of a string is denoted by dollar($) symbol. ^ matches with first character in the string and $ matches with last character of string.

When Using Multi-Lines:

 In practicality we have strings with multiple lines for example you are reading from a file.
In those cases, we need to explicitly tell the Regex engine to find matches in Multi-Line Mode like this:
 Regex.Match("string", "regex", RegexOptions.Multiline)

There are other anchors which match characters at the beginning and end of the line only. It will not include matches that happens at/after line breaks.They are \A stands for permanent start of string anchor and \Z stands for permanent end of string anchor.



Related Topics Links

Step 1 Learning regular expressions,


Step 2 Learning regular expressions


Step 3 Learning regular expressions


Step 4 Learning regular expressions
Regards
Sameer Shaik
Free Microsoft MCTS 70-536 Examination Training and Preparation for Jobs and Interviews
Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net.

No comments:

Post a Comment