Tag Archives: string parsing

Replace text in the lines of a string in C#

This example uses the following code to replace text in the lines of a string. private void btnGo_Click(object sender, EventArgs e) { try { Regex reg_exp = new Regex(txtPattern.Text); lblResult.Text = reg_exp.Replace( txtInput.Text, txtReplacementPattern.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); … Continue reading

Posted in regular expressions, strings | Tagged , , , , , , , , , , , , | 6 Comments