RegEx-Anleitung

by Michael R. Albertin 28. February 2009 18:33

Tags:

RegEx

Text-Zahl-Text in Gruppen zerlegen

by Michael R. Albertin 28. February 2009 18:31

Text-Zahl-Text in Gruppen zerlegen

// A12B --> A    12   B
// 12B  --> NULL 12   B
// A12  --> A    12   NULL
// 12   --> NULL 12   NULL
// A    --> A    NULL NULL
Match m = Regex.Match(textToSplitt, @"(\p{L}*)(\d*)(\p{L}*)");
string text1 = m.Groups[1].Value;
string zahl  = m.Groups[2].Value;
string text2 = m.Groups[3].Value;

Tags: ,

RegEx

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Syntax Error