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.


Matching literal (normal) text characters with Regular Expressions


Matching literal (normal) text characters with Regular Expressions

Basically regex are used to search a character, word, string or string pattern. Here we are going to search for a single literal character. Consider we want search for "o" in the string patter "Poonam like mango". It will match the "o" after the "P". The default behavior of most regular expression engines is to return just the first match. Though this regex can match the second "o" too. Most regex implementations provide a mechanism by which we can obtain a list of all matches when the regex engine start searching through the string after the first match.

Similarly, we want to search for "mango". The string is "I like mango. Mangoes are sweet". In the above example regex engine will search for m followed by a,n,g and o respectively, which returns only match "mango" and not "Mango" form "Mangoes". Regex engines are case sensitive by default, so "mango" does not match "Mango", unless you tell the regex engine to ignore text case.

You can use MS Word, EmEditor or Expresso to test your regex expressions. Expresso is very useful tool for learning how to use regular expressions and for developing and debugging regular expressions prior to incorporating them into C#.NET or VB.NET code. Expresso support for .NET 2.0 features like character class subtraction and new Unicode classes.

The regular expression language is designed and optimized to manipulate text. The language comprises two basic character types: literal (normal) text characters and metacharacters. The set of metacharacters gives regular expressions a boost to improve their processing power.

 

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

[...] Matching literal (normal) text characters with Regular Expressions [...]

Pingback by Text and Data Manipulation with Regular Expressions in .NET Development | Tips n Tracks on May 29, 2009 @ 5:05 am

Leave a comment

(required)

(required)

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