Hi,

I want to expand a variable including a regular expression (e.g.
^\p{Lu}(\p{L}|-| |')*$) and check whether it matches an operational
attribute.

Match with the regular expression itself works, variable expansion with
the same regular expression doesn't. It seems as all non ASCII
characters are stripped from the expanded variable or not interpreted
correctly.

I've tested it with IDM 3.5.1, eDir 8.8.2 and Designer 2.2.1.

Do I have to escape the regular expression in the variable somehow or is
it a bug?

Here is a test policy:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC
"policy-builder-dtd"
"C:\novell\Designer\eclipse\plugins\com.novell.des igner.idm.policybuilder_2.0.0.200710261247\DTD\dir xmlscript.dtd"><policy>
<rule>
<description>Variables</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="pattern" scope="policy">
<arg-string>
<token-text xml:space="preserve">^\p{Lu}(\p{L}|-| |')*$</token-text>
</arg-string>
</do-set-local-variable>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="cn" op="equal">^\p{Lu}(\p{L}|-|
|')*$</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-trace-message>
<arg-string>
<token-text xml:space="preserve">match</token-text>
</arg-string>
</do-trace-message>
</arg-actions>
<arg-actions/>
</do-if>
<do-if>
<arg-conditions>
<and>
<if-op-attr mode="regex" name="cn" op="equal">$pattern$</if-op-attr>
</and>
</arg-conditions>
<arg-actions>
<do-trace-message>
<arg-string>
<token-text xml:space="preserve">match</token-text>
</arg-string>
</do-trace-message>
</arg-actions>
<arg-actions/>
</do-if>
</actions>
</rule>
</policy>

And here is the Designer trace, it is the same as in dstrace.

Test :Applying policy: %+C%14CTemp%-C.
Test : Applying to add #1.
Test : Evaluating selection criteria for rule 'Variables'.
Test : Rule selected.
Test : Applying rule 'Variables'.
Test : Action:
do-set-local-variable("pattern",scope="policy","^\p{Lu}(\p{L}|-| |')*$").
Test : arg-string("^\p{Lu}(\p{L}|-| |')*$")
Test : token-text("^\p{Lu}(\p{L}|-| |')*$")
Test : Arg Value: "^\p{Lu}(\p{L}|-| |')*$".
Test : Action: do-if().
Test : Evaluating conditions.
Test : (if-op-attr 'cn' match "^\p{Lu}(\p{L}|-| |')*$") = TRUE.
Test : Performing if actions.
Test : Action: do-trace-message("match").
Test : arg-string("match")
Test : token-text("match")
Test : Arg Value: "match".
Test :match
Test : Action: do-if().
Test : Evaluating conditions.
Test : Expanded variable reference '$pattern$' to
'p{Lu}p{L}- ''.
Test : (if-op-attr 'cn' match "$pattern$") = FALSE.
Test : Performing else actions.
Test :Policy returned:
Test :
<nds dtdversion="2.0" ndsversion="8.x" xmlns:jdbc="urn:dirxml:jdbc">
<source>
<product build="20060630_0419" instance="JDBC"
version="2.1.2">DirXML Driver for JDBC</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<add class-name="User" src-dn="system/ace/user">
<add-attr attr-name="cn">
<value type="string">Lba r-</value>
</add-attr>
</add>
</input>
</nds>