variable regex label

Hullo experts,

Thanks for reading this thread. Quick question about regular expressions: we are retrieving the regex as a string from a database, retrieving it and then we want to evaluate the value of a variable against it, in a labelled branch;

Something like:

BRANCH (evaluate labels= true)
%/stringToCompare% == %/selectedRegEx%

The problem is now that the IS will treat %/selectedRegEx% as a string, and is not evaluating it. So the branch will only work if the value of /selectedRegEx is “/stringToCompare”, which is obviously not what we want.

Anybody know what does the trick?

Thanks,

Loic

Loic,

I’ve hit the same problem before (most recently on a 7.1.1 impl). It seems that evaluation of the label contents only occurs once - so once it has substituted the contents of variable selectedRegEx into the label, it’s done. No evaluation of the regular expression itself. This implies a single pass left to right evaluation of the label expression.

I never found a solution within the label itself.

Phil

Loic,

It sounds like you’ll need a Java service. Luckily, PSUtilities already has the service you need. Take a look at PSUtilities.regex:matches and see if it works for you.

  • Percio

Thanks for the input guys.

We looked around a bit, but couldn’t get it to work in flow, so we used the java regex API.

Cheers,

Loic