tags:

views:

23

answers:

2

Need to found any symbol of array.

For example: replace(string,[a,b,c,e,f,g],"a1b2c3d4e567"); result = "1234567"

How do it ?

A: 

AFAIK you are going to have to do this by consecutive calls to replace

result = "a1b2c3d4e567"
result = replace(result,"a","")
result = replace(result,"b","")
result = replace(result,"c","")

etc

nonnb
+2  A: 

If your goal is to remove all non-numeric characters, the following will work:

' Added reference for Microsoft VBScript Regular Expressions 5.5

Const s As String = "a1b2c3d4e567"
Dim regex2 As New RegExp
Dim a As String

regex2.Global = True
regex2.Pattern = "[^0-9]"
Dim a As String = regex2.Replace(s, "")

MsgBox (a)   ' Outputs 1234567

If you are looking for specific characters, change the pattern.

Edward Leno