Is it possible to make this work?

I am using the following pattern "\+\{([^}+]*)\}\+" to find "+{some text}+ and replace it with "+some text+".  To do this I am using "+$1+" as the replacement string.  This works perfectly.  

What I would like to know is if it is possible to change the pattern so that I could just use "$1" instead of "+$1+"?.  If so what would the pattern be?
NevSoFlyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
Depending on what style of regular expressions you are using
(?<=\+)\{([^}+]*)\}(?=\+)
may do it  for you
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NevSoFlyAuthor Commented:
Thanks.  I don't know what you mean by "what style of regular expressions" that I am using. But I am coding in VB.net.

I took your solution and it worked so I applied it to "+(some text)+" and "+[some text]+" as well.  I then tried to combine the three to cut down on code:
"(?<=\+)\{([^}+]*)\}|\[([^]+]*)\]|\(([^)+]*)\)(?=\+)"

That didn't work.  Any suggestions or should I post this to a new question?
0
ozoCommented:
(?<=\+)(?=(?:\{[^}+]*\}|\[[^]+]*\]|\([^)+]*\))\+).([^+]*)[]})](?=\+)
0
Terry WoodsIT GuruCommented:
If you were to add some () brackets around the \+ characters in the pattern (ie "(\+)\{([^}+]*)\}(\+)") then you would capture them and use $1$2$3 as the replacement, but I don't think it's possible to just use $1.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.