code_junkie

Quick & Dirty way to update “IDs” in a string formatted as XML (C#)

Nov 12th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. <VAR NAME="sf_name" ID="1001210">
  2.  
  3. ID="(d+)"
  4.  
  5. Regex r = new Regex("ID="(\d+)"");
  6. string outputXml = r.Replace(inputXml, new MatchEvaluator(ReplaceFunction));
  7.  
  8. public string ReplaceFunction(Match m)
  9. {
  10. // do stuff with m.Groups(1);
  11. return result.ToString();
  12. }
Add Comment
Please, Sign In to add comment