-3

I have this code and its posible to read numbers with regex (from an XML File), but i want to read an Alphanumeric string , and get the value as the numeric one:

string c1 = File.ReadAllText("C://XMLS/128839_SAG101208EJ4_10006_16_13-01-2017.xml");

           // i get 163.23 from the xml " subTotal="163.23" "

            Regex rx = new Regex(@"(?<=subTotal="")[0-9]+\.[0-9]+(?="")");

            //Check if matches
            var res = rx.Match(c1);

            if (res.Success)
            {
                var res2 = res.ToString();
                MessageBox.Show(res2);
            }

and here is the string i want to get >> UUID="a25101f7-65e7-49be-a8de-c8d7be8ec32d" and as you can see it also has " - " between letters

Thank you

PS : I don´t want to use XML libraries , just REGEX

1 Answers1

0

If you want only the UUID you can use this pattern:

[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Zroq
  • 8,002
  • 3
  • 26
  • 37