i need to parse a few tags (their value) from am XML.
this must be done by regex (don't ask me why
i know the pattern needed for each tag using regex
string name = "(?<=<name>).+?(?=</name>)";
string id = "(?<=<id>).+?(?=</id>)";
string gender = "(?<=<gender>).+?(?=</gender>)";
i just don't know how to init the Regex object to handle all of them.
i can do:
private static readonly Regex rgx1 = new Regex(name);
private static readonly Regex rgx2 = new Regex(id);
private static readonly Regex rgx3r = new Regex(gender);
but I'm guessing that's a terrible waste....
so my question is - how to init a single Regex to handle multiple patterns?
and once i did it , how to extract the values from it?
I'm programming in c# if anyone need to know....
10x alot !