using to test

if you want to match everything but the last 2 groups


use this:


and you get

  "index_name": [

the reason why this works is because you can actually match things outside of these parentheses:

(?<index_name> ... )

so the extra bits:


is gonna match the last 2 groups and the rest of the stuff what we want is matched by the remaining regex