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?
Who is Participating?
ozoConnect With a Mentor Commented:
Depending on what style of regular expressions you are using
may do it  for you
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

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?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.