Avatar of stroudtx
stroudtx
 asked on

Replace Pattern in ASP VB

I have this string - it's a variable so it changes per product.

Coverlet Size : Twin (+$0) [SIL216], Sheets : No Sheets (+$0), Extra Sheets : Twin Graphite Fitted Sheet (+$277) [BEL811], Shams : Graphite Standard New Primrose Sham (+$134) [NPRI301], Accent Pillows : Graphite Silk Velvet Throw (18x18) Pillow (+$132) [SVMB734]

I want to hide the mfg info which is inside the brackets [ ]

I use asp vb and I know there is an easy way to do this. I've searched Google, but I can't find anything that would work for me?
ASP

Avatar of undefined
Last Comment
stroudtx

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
octavient

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
stroudtx

ASKER
I can change the bracket to something else if it would make it easier to do? I just don't want to use () because they are used and I need them to stay.
octavient

Yes, I would definitely use something other than the bracket, if it's under your control.  Maybe the html brackets?  < >

Then your syntax would look something like this:

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With

strOutput = RegularExpressionObject.Replace(strOriginalString, "")
Set RegularExpressionObject = nothing
stroudtx

ASKER
Your first solution worked perfectly so I elected to stay with the bracket - thank you! Awesome solution!
Your help has saved me hundreds of hours of internet surfing.
fblack61