Re: System.Text.RegularExpressions sintaxis
From: Jiachuan Wang [MSFT] (jiawang_at_online.microsoft.com)
Date: 04/20/04
- Next message: Sharon: "Re: C# coding style question"
- Previous message: Julie: "Re: 25 MB"
- In reply to: Juan: "System.Text.RegularExpressions sintaxis"
- Next in thread: Hans Kesting: "Re: System.Text.RegularExpressions sintaxis"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Apr 2004 16:50:29 -0700
try the following short program. it find any char & or % or |
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string myString = "1&2|3%4&5|6%";
Match m = Regex.Match(myString,@"[&\|%]");
int matchCount = 0;
while (m.Success)
{
Console.WriteLine("Match"+ (++matchCount) + "\t\t" + m.Value);
m = m.NextMatch();
}
Console.ReadLine();
}
}
-- This posting is provided "AS IS" with no warranties, and confers no rights. "Juan" <juan_mauricio_lopez@ANTISPAMhotmail.com> wrote in message news:OUvBYVwJEHA.752@tk2msftngp13.phx.gbl... > Hi, I´m using System.Text.RegularExpressions, I want to find any acurrence > of the char & or % or | > > Ehat is the correct sintax for the Match method? This is what I´m usinf but > is not working: > Match myMatch = Regex.Match(myString,"^[&|%]*$"); > > Thanks, > > Juan. > > >
- Next message: Sharon: "Re: C# coding style question"
- Previous message: Julie: "Re: 25 MB"
- In reply to: Juan: "System.Text.RegularExpressions sintaxis"
- Next in thread: Hans Kesting: "Re: System.Text.RegularExpressions sintaxis"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|