Create an Apache SetEnv variable with the value of a subclaim

284 Views Asked by At

I have an environment variable called FIRST and containing a JSON :

{ "claim1": "val1", "claim2": "val2" }

I would like to set a new environment variable which should contain only val1.

I tried to set this new variable (SECOND) using SetEnvIf but unfortunately this doesn't work:

SetEnvIf FIRST (\"claim1\":)(.*?)\"(.*?)\" SECOND=$3

The regex is correct, you can check it here : demo

The FIRST variable is not a request attribute even if it seems to be required according to the Apache Module mod_setenvif documentation..

Any idea how I could achieve this ?

Thanks !

0

There are 0 best solutions below