1

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

2

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 @

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.