Quote Originally Posted by VJendrusch View Post
Hi all,

i am looking for a solution to build into an Bidirectional LDAP Driver.
The source CN consists of multiple informations that are not spearated by a certain character or something like that. The only way to find that part i need is with an complex regex. I only need the part the regex found and if there is also an leading "-" i have to get rid of it and use the rest of the result to write it back into a local variable.
What do i want with that?
I have an source CN like that: Blah-All-467777-78-NYC or Blah-2490-4712-NYC...
I also have an matching but not (yet) associated (target-) object like: Blah-all.467777-78.Groups.STUDIO.NYC.US.AME or for the other one: Blah-2940.4712.Groups.Studio.NYC.US.AME.
So i have to parse the source CN with an regex and use the find to construct a new DN.
I think it has to be ECMA but i am not familar with it.
Any ideas?
Thx in advance
I don't understand why you're doing this, but doing it should be easy enough.

You can get the CN in to a local variable:

set local variable foo = source-attribute CN
Be careful if CN can be multivalued in this system. Maybe use source-name there instead, assuming your source is using CN for the naming attribute. Or get the DN and parse the name off of it.

Then you can apply a regex to it:

<do-set-local-variable name="bar" scope="policy">
  <token-replace-all regex="(?-i)[^A-Z]" replace-with="">
   <token-local-variable name="foo"/>
Put your RegEx in there, of course. Then you can go do whatever complicated things you need to do with this local variable to build a DN or whatever.

Does that not do what you need?