|
-
Aug 7th, 2011, 05:48 AM
#1
Thread Starter
New Member
Replace two duplicate word into two different words
Hi members, Can some one solve my code.
I need to Replace two duplicate word into two different words.
Like:
abc is a search engine and also abc a search engine.
to
google is a search engine and also yahoo a search engine.
I tried this.
TextBox1.Text = Replace(TextBox1.Text, "abc", "google")
But it replaces all abc to google. But I need to change first abc to google and second abc to yahoo and so on.
also tried this one
Dim m14 As MatchCollection = Regex.Matches(TextBox1.Text, "abc", RegexOptions.Singleline + RegexOptions.IgnoreCase)
For Each n1 As Match In m14
Dim value As String = n1.Groups(0).Value
'MsgBox(value)
If value.Contains("abc") Then
TextBox1.Text = Replace(TextBox1.Text, "abc", "google")
'MsgBox("found")
End If
Next
I Need some ones help.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|