Can Regex expression be fetched dynamically from KVM?

Can Regex expression be fetched dynamically from KVM? Getting error at the time of deployment.

Below is the dynamic value fetched:

<RegularExpressionProtection name="RE-RegularExpression-Check"> 
  <DisplayName>RE-RegularExpression-Check</DisplayName> 
  <Properties/> 
  <Source>request</Source> 
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> 
  <Variable name="request.content"> 
    <Pattern ignoreCase="true">{sqlRegexPattern}</Pattern> 
  </Variable> 
</RegularExpressionProtection>

Below is the value present in KVM:

[\s]*((select)|(delete)|(exec)|(drop\s*table)|(insert)|(shutdown)|(update))

Please help!!!

Solved Solved
0 5 496
1 ACCEPTED SOLUTION

Nope.

The Pattern element does not accept a MessageTemplate .

If you wanted to dynamically load the regex, then you could do so using a JavaScript callout.

I don't understand the use case though. Why would you want this? Under what circumstances would the regex need to change dynamically?

View solution in original post

5 REPLIES 5

Nope.

The Pattern element does not accept a MessageTemplate .

If you wanted to dynamically load the regex, then you could do so using a JavaScript callout.

I don't understand the use case though. Why would you want this? Under what circumstances would the regex need to change dynamically?

Thanks Dino for getting back. There is a necessity to take the regex values outside of the code. Hence we decided to keep those regex patterns in KVM and trying to call the same internally.

@niraimathi313 I am looking for the solution of the same use case. Is there any solutions?

Did you read my suggestion -  use JavaScript to run the Regex ? 

Does that work for you?  If not, why not? Can you explain further?

@niraimathi313 @dchiesa1 I am looking for the solution of the same use case. Is there any way ?