Skip to content
WJunction - Webmaster Forum

Regular Expressions in VB.NET 2005 ?

Status
Not open for further replies.

Cojba

Experienced Member
704
2010
23
'Define regex
Dim regExp As RegularExpressions.Regex

'Italic text
regExp = New RegularExpressions.Regex("<i>$1</i>")
RichTextBox2.Text = regExp.Replace(RichTextBox1.Text, "\[i\](.+?)\[\/i\]")

Input should be: <i>blahblah</i> and output blahblah, but it gives me same text from richtextbox1 in richtextbox2. Anyone can see whats wrong in this code ? :S
 

7 comments

this is for C#


if(!regex((^[1-9]{2}-[0-9]{3}-[0-9]{7}$).Success)) )
{
MessageBox.Show("Invalid phobe Number");
}

this some like validating
+92-61-4561239
 
Last edited:
you shoud never ever use regex to parse html. the best and fastest way to parse strings is using IndexOf. There is a HTML agility pack that allows you to use xPath.
 
Status
Not open for further replies.

About the author

C
Experienced Member · Joined
704
Messages
23
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom