Given foo bar monkey [foo bar monkey] foo bar monkey
, how would you match only the bar
within the brackets?
\[(bar)+\]
is as close as I can get it from an understanding and research perspective (brackets are matched, then we're selecting only the exact text within the brackets 1 or more times) however it matches nothing I want it to. \[(.*)+\]
matches everything in brackets, including the brackets, but I can't seem to filter it to only bar
regardless of what I try.
EDIT: I'm using a replace in directory function in a JetBrains IDE. I'm not sure what language they use for processing regex.