Avatar of Wayne Barron
Wayne Barron
Flag for United States of America asked on

vb.net REGEX

Hello, all.

I have these two commands

Example insert

{Something here} {{Something else here}}

Open in new window


Dim Regex2 As Regex = New Regex("\{.*?\}")
Dim Regex4 As Regex = New Regex("\{{.*?\}}")

Open in new window


They do not produce any errors, however.
The single { }
Will insert into the database for the {{ }}
In the database, you will see
{Something here}

Open in new window

With the curly brackets around it.

How can I distinguish between the two commands, so that only the double curly's will insert into its column, and the single curly will only insert into its column?

Thanks
Wayne
Regular ExpressionsVisual Basic.NETMicrosoft SQL Server

Avatar of undefined
Last Comment
Wayne Barron

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill Prew

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.
Wayne Barron

ASKER

Unfortunately, it does not work.
Still inserts the  {Something here}

Wayne Barron

ASKER

IT WORKED!!!

Bill Prew

Maybe I didn't understand.  I thought you wanted Regex2 to match the {Something here} but not the {{Something else here}}.  That's what the regex I posted does do.

Maybe I need to understand better what you're doing and how you're using those patterns...


»bp
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Bill Prew

Okay, great, our posts crossed.


»bp
Wayne Barron

ASKER

Yea, I was thinking it might over post you.
All good.
To be honest, I think the original would have worked as well.
I noticed in my code, that I had the wrong variable called, and I was using the single Curly variable and not the double curly variable. But either way, it works great.

Wayne