Next Match : Regex Match « Regular Expression « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Regular Expression » Regex Match 
17.6.12.Next Match
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Reflection;

public class MainClass{

   public static void Main(){
        Regex r = new Regex(@"^\G\d+$\n?", RegexOptions.Multiline);
        Match m = r.Match("13\n38\n18\n5");
        do {
            Console.WriteLine("Match: " + m.Value);
        while ((m = m.NextMatch()).Success);
   }
}
Match: 13

Match: 38

Match: 18

Match: 5
17.6.Regex Match
17.6.1.Match words that start with 's'
17.6.2.Match words that start with 's' and end with 'e'
17.6.3.Match words that contain two consecutive identical characters
17.6.4.Match words that contain 'u'
17.6.5.Match words that contain the pattern 'ai'
17.6.6.Match words that contain the pattern 'ai' or 'ie'
17.6.7.Match words that contain 'k' or 'f'
17.6.8.Match words that contain any letters in the range 'b' through 'd'
17.6.9.Use Regex to validate your input
17.6.10.Get matched parts
17.6.11.Match index and value
17.6.12.Next Match
17.6.13.Using Match Collection
17.6.14.Capture Collection
17.6.15.\s Match a white-space character.
17.6.16.[A-Z] Match any uppercase character from A to Z.
17.6.17.\w* Match zero or more word characters.
17.6.18.\b Match a word boundary.
17.6.19.th Match the literal characters "th".
17.6.20.[^o] Match any character that is not an "o".
17.6.21.\w+ Match one or more word characters.
17.6.22.Strip HTML start and end tags from each string if they are present
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.