Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Regular Expression Not Working in Condition

Hi all,

I am trying to use a condition to catch the case in which the query string of a request contains two or more parameters from a specific list. In such a case I wish to raise an error.

Of course, I can use many "and" and "or" clauses, but that will get very messy very quickly as the size of the list of parameters increases. So instead, I opted to use a regex to test for this.

As an example, if the list of parameters is [Bird,Dog,Horse], then any request who has two or more of these parameters in its query string should be matched.

The regular expression I am using is:

 /(.*(Bird|Dog|Horse).*){2} 

I tested in various regex testers and it works.

However, when I put the condition:

<Condition>request.querystring Matches "/(.*(Bird|Dog|Horse).*){2}"</Condition> 

I never get a match.

Am I missing some specific APIGEE regex rules? Maybe the "{2}" is not supported in APIGEE? Thank you very much!!

Adam

Solved Solved
1 7 4,090
1 ACCEPTED SOLUTION

Similar question is answered here .

Use JavaRegex in your condition.

View solution in original post

7 REPLIES 7