Checking your provided examples { "12,3 m", "A12,3 m", "ABC3.45", "4.5 DEF"}
it seems that the string position can not only change but there can be 2 strings and one decimal in your inputstrings.
This solution will show you how to extract these data with only one regex and no manual string split. I will incorporate the CultureInfo from user1666620:
string[] inputStrings = new string[] { "12,3 m", "A12,3 m", "ABC3.45", "4.5 DEF"};
Regex splitterRx = new Regex("([a-zA-Z]*)\\s*([\\d\\.,]+)\\s*([a-zA-Z]*)");
List<Tuple<string, decimal, string>> results = new List<Tuple<string, decimal, string>>();
foreach (var str in inputStrings)
{
var splitterM = splitterRx.Match(str);
if (splitterM.Success)
{
results.Add(new Tuple<string, decimal, string>(
splitterM.Groups[1].Value,
decimal.Parse(
splitterM.Groups[2].Value.Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator).Replace(
",", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)
),
splitterM.Groups[3].Value
));
}
}
This will find all possible combinations of a present/not present string in pre/post position, so be sure to check the individual strings or apply any combining logik unto them.
Also it doesn't only check for the presence of a single space between the decimal and the strings but for the presence of any number of whitespaces. If you want to limit it to definately only 0 or 1 space instead replace the Regex with this:
Regex splitterRx = new Regex("([a-zA-Z]*)[ ]{0,1}([\\d\\.,]+)[ ]{0,1}([a-zA-Z]*)");