2

Need to found any symbol of array.

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

How do it ?

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.