I have an xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="name">word1</string>
<string name="namee">word2</string>
<string name="nameee">word3</string>
</resources>
I want to find every word between > <. Therefore word1, word2 and word3. I have written some code but that regex expression find only the first word (word1).
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader sr = new StreamReader(openFileDialog1.FileName);
string s = sr.ReadToEnd();
richTextBox1.Text = s;
}
string txt = richTextBox1.Text;
string foundWords = Regex.Match(txt, @"\>(\w+)\<").Groups[1].Value;
richTextBox1.Text = foundWords;
}
I want to find every word between > < and display it in a rich textbox.