Hi mates,
I'm going to make a program to replace some words within a text document. I am currently using regex.replace to replace the word within the string but it is not working for my situation.
for example the program is reading the txt line by line and let say if I want to replace "No" to "いいえ". when the program read something like PaymentNo as I am using "\bNo\b" but when the string is Payment No., it would replace it, but what I want is the program would only replace the string if the string is == No, my part of code is:
strData = TS.ReadLine()
If (InStr(1, strData, stra1, 0)) > 0 Then
regex.Global = True
strPattern = "\b" & stra1 & "\b"
If (InStr(1, strData, stra1)) > 0 Then
regex.Pattern = strPattern
rmpstrData = regex.Replace(strData, stra2)
End If
End If
TS is the text document and stra1 is string that read from a excel.
anyone help??
Cheer,
Kent
I'm going to make a program to replace some words within a text document. I am currently using regex.replace to replace the word within the string but it is not working for my situation.
for example the program is reading the txt line by line and let say if I want to replace "No" to "いいえ". when the program read something like PaymentNo as I am using "\bNo\b" but when the string is Payment No., it would replace it, but what I want is the program would only replace the string if the string is == No, my part of code is:
strData = TS.ReadLine()
If (InStr(1, strData, stra1, 0)) > 0 Then
regex.Global = True
strPattern = "\b" & stra1 & "\b"
If (InStr(1, strData, stra1)) > 0 Then
regex.Pattern = strPattern
rmpstrData = regex.Replace(strData, stra2)
End If
End If
TS is the text document and stra1 is string that read from a excel.
anyone help??
Cheer,
Kent