Click to See Complete Forum and Search --> : [RESOLVED] Turkish chars in RegExp


telmessos
03-24-2010, 04:12 AM
Hi all,

I have the following function which removes the invalid chars on a string. It works really fine apart from removing the Turkish characters in the string such as İ,ı,ş,Ş,Ç,ç,Ğ,ğ,ü,Ü,Ö,ö .

Does anyone know a solution about this problem?

Thanks
telmessos

Here is the code:


Set objRegExp = New Regexp
Function makesafe(strInput)
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "[^A-Z^a-z^0-9\s]"
makesafe = objRegExp.Replace(strInput, "")
End Function

telmessos
03-24-2010, 06:27 AM
I fixed the problem myself. By adding the Turkish chars to the pattern.

So finally it became .


Set objRegExp = New Regexp
Function makesafe(strInput)
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "[^A-Z^a-z^0-9^şŞıİçÇöÖüÜĞğ\s]"
makesafe = objRegExp.Replace(strInput, "")
End Function