-1

Not actually too sure what to title this question. I'm attempting to match only whats between $[( and )] each time. However the regex I'm using is matching the first $[( and last )] in the entire string instead of each individual occurrence within a string.

Each occurrence could have literally anything around it. The contents could be even as complex as $[(("$[username]").substr(1))] So the contents should be possible to be anything too.

You can see a demo of this regex here: https://regex101.com/r/Wr1e6D/1

and the attached screenshot.

Regex 101 Demo

TMFKSOFT
  • 29
  • 8

1 Answers1

0

If you know that inside the parenthesis will be alphanumeric characters, you use the following:

\$\[\(([\w\d]*)\)\]
Guilhermevrs
  • 2,094
  • 15
  • 15