Celeb Glow
news | March 15, 2026

Find string surrounded by specific character, replace the characters but keep the string intact

I have several documents that contains variables which need need to be changed from this:

@CapitalPx@

To this:

${CapitalPx}

I found out about finding and replacing using regex, and came out with the following one:

\@([a-z0-9]+)\@

My ultimate goal is to replace what I found with something that would look like the following:

\$\{([a-z0-9])\}

but it just replaces what I found by this string without interpreting it.

I also tried to find a regex that would match word starting or finishing with '@', but it doesn't work at 100% (LibreOffice seems limited for this)

Does anyone have a suggestion?

Thank you in advance

1 Answer

I'd do:

  • Find: @(\w+)@
  • Replace: ${$1}

Check Regular expression.

Explanation:

@ : literally @
( : start group 1 \w+ : 1 or more word character
) : end group 1
@ : literally @
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy