I have the following string:
"483 432,96 (HM: 369 694,86; ZP: 32 143,48; NP: 4 507,19; SP: 40 800,62; SDS: 4 389,84; IP: 9 497,14; PvN: 3 157,25; ÚP: 3 102,14; GP: 808,28; PRFS: 15 332,16)"
What I am trying to do, is to retrieve all values (if they exist) for the following letters (I highlighted necessary values in bold below):
483 432,96 (HM: 369 694,86; ZP: 32 143,48; NP: 4 507,19; SP: 40 800,62; SDS: 4 389,84; IP: 9 497,14; PvN: 3 157,25; ÚP: 3 102,14; GP: 808,28; PRFS: 15 332,16)
I tried to retrieve values one by one with the following regex:
string regex = "NP: ^[0-9]^[\\s\\d]([.,\\s\\d][0-9]{1,4})?$";
But with no luck either (I am a newbie in Regex patterns).
Is it possible to retrieve all values in a one string (and then simply loop through the results), or do I have to go one key at the time?
Here is my full code:
string sTest = "483 432,96 (HM: 369 694,86; ZP: 32 143,48; NP: 4 507,19; SP: 40 800,62; SDS: 4 389,84; IP: 9 497,14; PvN: 3 157,25; ÚP: 3 102,14; GP: 808,28; PRFS: 15 332,16)";
string regex = "NP: ^[0-9]^[\\s\\d]([.,\\s\\d][0-9]{1,4})?$";
System.Text.RegularExpressions.MatchCollection coll = System.Text.RegularExpressions.Regex.Matches(sTest, regex);
String result = coll[0].Groups[1].Value;