0

I'm building a vbscript and I m using a Regexp Object. I need help to create a regex pattern that finds the following words/chars

Advanced
Standard
Enterprise
Edition
(R)
®
@

The script :

Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = ""
objRegExp.Replace(myVar, "")    

What Should I have in

objRegExp.Pattern = ""  
1
  • 1
    Formatting to improve readability. Poster needs to edit to include what they've tried in the way of regular expressions that haven't worked.
    – Ken White
    Jun 28, 2016 at 0:03

1 Answer 1

0

Given that the encoding of code and data is compatible:

Option Explicit

Dim s : s = "1Advanced2Standard3Enterprise4Edition5(R)6®7@8,9"
Dim r : Set r = New RegExp
r.Global = True
r.Pattern = "Advanced|Standard|Enterprise|Edition|\(R\)|®|@|,"
WScript.Echo r.Replace(s, "")

output:

cscript 38061990.vbs
123456789

Update wrt comment:

Based on this:

Option Explicit

Dim csCircledR : csCircledR = ChrW(&H00AE)
Dim s : s = "1Advanced2Standard3Enterprise4Edition5(R)6" & csCircledR & "7@8,9"
Dim r : Set r = New RegExp
r.Global = True
r.Pattern = "Advanced|Standard|Enterprise|Edition|\(R\)|" & csCircledR & "|@|,"
WScript.Echo s
WScript.Echo r.Replace(s, "")

output:

cscript 38061990.vbs
1Advanced2Standard3Enterprise4Edition5(R)6®7@8,9
123456789
1
  • Thank you for your help, is it possible to include Chr(Code) inse the pattern?
    – NKF
    Jun 28, 2016 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.