Blog
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    APIs
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
 

Home >> C# >> Regular Expressions in C#
Regular Expressions in C#

what is the regular expression and main aspect of its?
Views: 1176     Comments: 0
by Amit Singh on 1/18/2011

Regular Expressions

Regular expressions are used for searching and manipulating a large text. A regular expression check the following condition such as

·         To identify substrings that begins with or ends with a pattern of characters.

·         To find all words that begins with a group of character and end with some others characters.

·         Check the occurrence of a string pattern.

·         To modify one or more substrings and return them

It is also know as pattern string. It is the part of strings and it containing two types of characters.

·         Literals

·         and metacharacters

For example

“\bt” which means any word beginnings with t.

Where \b is metacharacter and t is the literals.

We used the namespace System.Text.RegularExpression for regular expression. Such namespace contain number of classes that can be used for searching and matching and modifying a text document. The important classes are

·         Regex

·         MatchCollection

·         Match

How uses these classes in our program

For example

using System;

using System.Text;

using System.Text.RegularExpressions;

class CheckRegExp

{

    public static void Main()

    {

        string str;

        str = "india,srilanka,nepal,berma";

        Regex reg = new Regex("|,");

        foreach (string s in reg.Split(str))

        Console.WriteLine(s);

        Console.ReadLine();

    }

}

 

Title :  
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
       
 
Report Abuse Form
Reason:    
 
Latest ArticleRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest Blogs by Amit SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2677
  
Copyright © 2013MindStick. All Rights Reserved.