Re: System.Text.RegularExpressions sintaxis

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Jiachuan Wang [MSFT] (jiawang_at_online.microsoft.com)
Date: 04/20/04


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.
>
>
>


Relevant Pages

  • Re: Multiple instances of application
    ... This is the code I put into muy WinForms apps to allow for only 1 instance: ... /// The main entry point for the application. ... [STAThread] ... static void Main ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Run stored procedure from C#
    ... /// The main entry point for the application. ... [STAThread] ... static void Main ... My stored procedure has three select stat?ments: ...
    (microsoft.public.sqlserver.programming)
  • Different Entry Point
    ... Is is possible to define a different entry point than Main? ... [STAThread] ... static void MainEntryPoint() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Display class
    ... +D: Author: ks0108 LCD Controller driver ... * GNU General Public License for more details. ... +void cfag12864b_set(unsigned char x, unsigned char y) ... +static void cfag12864b_setbit ...
    (Linux-Kernel)
  • [PATCH 2.6.19-rc1 full] drivers: add LCD support
    ... Adds support for the ks0108 LCD Controller as a device driver. ... * GNU General Public License for more details. ... +static void cfag12864b_setbit(unsigned char state, ...
    (Linux-Kernel)