Link to home
Create AccountLog in
Avatar of Wayne Barron
Wayne BarronFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Wayne Barron

ASKER

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

IT WORKED!!!

Avatar of Bill Prew
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
Okay, great, our posts crossed.


»bp

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