Click here to Skip to main content
15,890,438 members

Comments by amit_upadhyay (Top 41 by date)

amit_upadhyay 9-Jan-13 5:44am View    
learn how to code before finding faults. the globalvariable is a class
amit_upadhyay 1-Dec-11 3:32am View    
hey thanks but i did get the ascii of the chars (substring till a char or digit is found) but it returned 32 which i suppose is space. Will getting it in bytes help me anyway ?
amit_upadhyay 28-Nov-11 5:14am View    
yeah even that would work. How do i do that? Could you point me to some link or code plz? I mean after a thread has completed its work do i just take another url from list?
amit_upadhyay 13-Nov-11 23:33pm View    
hey thanks. it works great. But iam stuck with implementing this into my main program which is a slightly modified :

Dim fil2 As New StreamReader("new2.txt")

Dim i As Integer = 0
Dim start2 As Integer = 0
Dim rgx As Regex

Dim rpl As String = RichTextBox1.Text

Do While fil2.Peek > -1
Dim StringToCheck As String = fil2.ReadLine()
Dim prev As String = StringToCheck.Split("|")(0).Trim()

If (StringToCheck.Split("|")(0).Split(" ").Count >= 2) Then
Try
rgx = New Regex("(?!{[^{]*)" & prev & "(?![^{}]*})", RegexOptions.IgnoreCase)
Dim z As Integer = 0

rpl = rgx.Replace(rpl, "zzzzxxxxzzzz")

Catch ex As Exception

End Try
End If


Loop

fil2.Close()

RichTextBox1.Text = rpl


currently do you see anything which can be wrong with this code? What it is doing is reading a text file, splitting the line at "|" and then count the number of words in first segment. Then it will create a pattern dynamically including the split word instead of "buy". The output is not what i want.

with the above string i get :

zxzxzxzxzxzxzxzxzx zxzxzxzxzxzxzxzxzx zxzxzxzxzxzxzxzxzx to zxzxzxzxzxzxzxzxzx buy zxzxzxzxzxzxzxzxz zxzxzxzxzxzxzxzxzx xzxzxzxzxzxzxzxzx xzxzxzxzxzxzxzxzx ho zxzxzxzxzxzxzxzxzx zxzxzxzxzxzxzxzxzx zxzxzxzxzxzxzxzxzx d zxzxzxzxzxzxzxzxzx this zxzxzxzxzxzxzxzxzx house zxzxzxzxzxzxzxzxzx is zxzxzxzxzxzxzxzxz zxzxzxzxzxzxzxzxzx xzxzxzxzxzxzxzxz zxzxzxzxzxzxzxzxzx xzxzxzxzxzxzxzxzx good zxzxzxzxzxzxzxzxzx that zxzxzxzxzxzxzxzxzx i zxzxzxzxzxzxzxzxzx will zxzxzxzxzxzxzxzxzx {buy|purchase|rent|acquire} zxzxzxzxzxzxzxzxzx this zxzxzxzxzxzxzxzxzx place
amit_upadhyay 13-Nov-11 23:22pm View    
Deleted
hey is there any difference if the word buy is changed to be a 2-3 word string. The above works flawlessly but this :

Dim rgx As New Regex("(?!{[^{]*)wanted to(?![^{}]*})")

RichTextBox1.Text = "I wanted to purchase a house and this house is so good that i will {wanted to|purchase|rent|acquire} this place"

RichTextBox1.Text = rgx.Replace(RichTextBox1.Text, "purchase")


gives the following output :
I purchase purchase a house and this house is so good that i will {wanted to|purchase|rent|acquire} this place