Good morning guys
Is there a good way to use regular expression in C# in order to find all filenames and their paths within a string
variable?
For e
If you use
tag and the final text could be represented as well formatted xml document (as far as being inner xml, i.e. text without root tags), you probably can do:
var doc = new XmlDocument();
doc.LoadXml(String.Concat("", input, " "));
var files = doc.SelectNodes("//file"):
or
var doc = new XmlDocument();
doc.AppendChild(doc.CreateElement("root"));
doc.DocumentElement.InnerXml = input;
var nodes = doc.SelectNodes("//file");
Both method really works and are highly object-oriented, especially the second one.
And will bring rather more performance.
See also - Don't parse (X)HTML using RegEx