, , Expresso, :
string s = "18.jun. 7 noči od 515,00 EUR";
Regex r = new Regex(@"\d+((.\d+)+(,\d+)?)?");
foreach (Match m in r.Matches(s))
{
Console.WriteLine(m.Value);
}
, , , . :
Console.WriteLine("{0,10} {1,10} {2,10} {3,10}",
@"Group 0", @"Group 1", @"Groups 2", @"Group 3");
Regex r = new Regex(@"\d+((.\d+)+(,\d+)?)?");
foreach (Match m in r.Matches(s))
{
Console.WriteLine("{0,10} {1,10} {2,10} {3,10}",
m.Groups[0].Value, m.Groups[1].Value, m.Groups[2].Value, m.Groups[3].Value);
}
:
Group 0 Group 1 Group 2 Group 3
18
7
515,00 ,00 ,00
. , , . , , ,00 , :
@"(?n)\b\d+(\.\d+)*(,\d+)\b"
(?n) - ExplicitCapture, , . RegexOptions , - , - Compiled, , hogging. \b - .
It looks like you are applying all of these modifiers blindly to each regular expression when you create them, which is not very good. If a particular regular expression needs a specific modifier, you should try to specify it in the regular expression itself using the built-in modifier, as I did with (?n).