madhu.13sm
madhu.13sm

Reputation: 354

How do I search for a word in the entire XML using Regex?

In my XML I want to search for Text=" if it is not present then I want to do this

XMLString = Regex.Replace(XMLString,@"(?<=<Run[^<]*)>", " Text=\"",RegexOptions.IgnoreCase);

Now whats the regex to find Text=" in the entire XML?

Upvotes: 0

Views: 88

Answers (1)

user1769555
user1769555

Reputation:

if (Regex.IsMatch(XMLString," Text=\"")==false)
           XMLString = Regex.Replace(XMLString,@"(?<=<Run[^<]*)>", " Text=\"",RegexOptions.IgnoreCase);

Upvotes: 1

Related Questions