Unclosed charater exception when using path transformation using regular expression


I am using Api Gateway’s request transformation, the transformation rules are applied based on a specific request.path pattern. Identification of the path /SOMETEXT/case/SOMETEXT is done using regex ^/[a-zA-Z0-9-.~_ ]+/case/[a-zA-Z0-9-.~_ ]+$. When a request is made matching the above pattern an exception is thrown as shown below, the regular expression itself is valid - its been tested at regex101.com.

{"Exception":"API Gateway encountered an error. Error Message:  Exception occured while executing transformation policy. Exception:
Unclosed character class near index 19
^\/[a-zA-Z0-9-.~_ \. Request Details: Service - ecase, Operation - /{domainName}/case/{id}, Invocation Time:10:49:01, Date:19.3.2020,  Client IP -, User - Default and Application:sys:defaultApplication"}

From the error message it appears that there is problem with closing ‘]’ bracket, but i am unable to determine a proper fix for this. Looking forward for a solution.


Hi Manjunath,

Can you please attach the API you tried?

If it is not possible to provide the API, provide the values configured in the transformation conditions and in the transformation configuration sections.


Hi Vallab,

Thanks for reverting back, please see the attached word document, i felt it was easier to explain this way. Also, this is my first project with Gateway, i might be doing things wrong, or, adopting wrong means. Request you to guide me to improve the solution. One constraint is that i cannot use Dynamic transformation since it has dependency on IS Service - this is enforced from the client.

Kindly let me know if you need further information.


Issue.docx (153 KB)