Stefan Ristic

Stefan Ristic

  • NA
  • 1
  • 1.8k

Problem with Regular Expressions

Mar 24 2011 5:25 PM
Ok, I have a problem using Regular Expressions in VB.NET 2005:

Imports System
Imports System.Text
Imports System.Text.RegularExpressions

'Define regex
Dim regExp As Regex

'Italic text
regExp = New Regex("<i>$1</i>")

RichTextBox2.Text = regExp.Replace(RichTextBox1.Text, "\[i\](.+?)\[\/i\]")

From my point of view, this code should change <i>blahblah</i> from richtextbox1 into [i]blahblah[/i] in richtextbox2.

But, when I Debug this app, it just copy <i></i>(or anything I type in) into richtextbox2. No change. Someone can see where is my problem ?

Answers (4)