June 2012
Intermediate to advanced
136 pages
2h 50m
German
//Suche nach Spider-Man, Spiderman, SPIDER-MAN usw.
namespace Regex_PocketRef
{
using System.Text.RegularExpressions;
class SimpleMatchTest
{
static void Main( )
{
string dailybugle = "Spider-Man Menaces City!";
string regex = "spider[- ]?man";
if (Regex.IsMatch(dailybugle, regex, RegexOptions.IgnoreCase)) {
//hier passiert etwas
}
}
}//Datumsangaben in Formaten wie MM/DD/YYYY, MM-DD-YY ...
//mittels System.Text.RegularExpressions erkennen
class MatchTest
{
static void Main( )
{
string date = "12/30/1969";Regex r = new Regex( @"^(\d\d)[-/](\d\d)[-/](\d\d(?:\d\d)?)$" ); Match m = r.Match(date); if (m.Success) { string monat = m.Groups[1].Value; string tag = m.Groups[2].Value; string jahr = m.Groups[3].Value; ...Read now
Unlock full access