Groups > IBM > IBM Tivoli Directory Integrator > Re: Regular Expressions




Regular Expressions

Regular Expressions
Thu, 13 Dec 2007 14:48:38 -080
Hello,

Is there a new way to get the following snippet of code to match an open 
parenthesis "("?

Array[i].match("\\("))

After upgrading to IDI 6.1.1 on AIX, this piece of code no longer matches a 
"(" and the flow falls into the wrong section of code in an Override
Lookup 
hook.

Any ideas?

Thanks in advance.

More later...

Z.




Post Reply
Re: Regular Expressions
Fri, 14 Dec 2007 09:18:52 +010
Hi Zareh,

I test this code:

    s = "this is a test of matching( with param )";
    task.logmsg(s.match("matching\\(")[0]);

in both 6.0 and 6.1.1 and got the same results:

09:15:55  matching(

Perhaps you could clip in a larger section of the code
in question so I could see the context of your match.
Or you could take this straight to our L2 support gurus.

-Eddie

Zareh Movsessian wrote:
> Hello,
> 
> Is there a new way to get the following snippet of code to match an open 
> parenthesis "("?
> 
> Array[i].match("\\("))
> 
> After upgrading to IDI 6.1.1 on AIX, this piece of code no longer matches a

> "(" and the flow falls into the wrong section of code in an
Override Lookup 
> hook.
> 
> Any ideas?
> 
> Thanks in advance.
> 
> More later...
> 
> Z.
> 
> 
> 
> 
Post Reply
Re: Regular Expressions
Fri, 14 Dec 2007 11:35:09 -080
Hi Eddie,

Thanks for responding.

Here is some more code...

There is an attribute called PARRS which could have values like the 
following:

"TK0Z(1-9),UPARRBK1"

The piece of code needs to expand this into a bunch of RACF groups and add 
them to the kpRacfGroup attribute as separate values.  In this case, the 
values should look like:

NCAL<BREAK>PARRS<BREAK>TK0Z1
NCAL<BREAK>PARRS<BREAK>TK0Z2
NCAL<BREAK>PARRS<BREAK>TK0Z3
NCAL<BREAK>PARRS<BREAK>TK0Z4
NCAL<BREAK>PARRS<BREAK>TK0Z5
NCAL<BREAK>PARRS<BREAK>TK0Z6
NCAL<BREAK>PARRS<BREAK>TK0Z7
NCAL<BREAK>PARRS<BREAK>TK0Z8
NCAL<BREAK>PARRS<BREAK>TK0Z9
NCAL<BREAK>PARRS<BREAK>UPARRBK1

The piece of code that's failing, is supposed to match the open and close 
parentheses and then expand the "1-9" into "1,2,3,...,9".

Here are the relevant parts.

parrs = work.getString("PARRS");
parrsArray = parrs.split(",");

expandGroupSpec("NCAL","PARRS",parrsArray);

function expandGroupSpec(system,application,groupSpecArray) {
 var groupList = new Array();

 for (i = 0; i < groupSpecArray.length; ++i) {

  if ((groupSpecArray[i].match("\\(")) &&
(groupSpecArray[i].match("\\)"))) 
{

   // Split name into begin, middle, end
   var components = groupSpecArray[i].split("(\\(|\\))");

   // Find the counter
   if (components[0].match("[0-9]-[0-9]")) {  // Either in the begin
    groupList = 
enumerateGroups(components[0],components[1],components[2],components[0]);
   } else if (components[1].match("[0-9]-[0-9]")) { // In the middle
    groupList = 
enumerateGroups(components[0],components[1],components[2],components[1]);
   } else if (components[2].match("[0-9]-[0-9]")) { // In the end
    groupList = 
enumerateGroups(components[0],components[1],components[2],components[2]);
   }

   // Add enumerated groups into entry
   for (z=0; z<groupList.length; z++) {
    // Construct the actual value that will be written to the entry
    // system<BREAK>application<BREAK>group
    var newValue = system + "<BREAK>" + application +
"<BREAK>" + 
groupList[z];
    work.addAttributeValue("kpRacfGroup", newValue);
   }
  } else {
   // Construct the actual value that will be written to the entry
   // system<BREAK>application<BREAK>group
   var newValue = system + "<BREAK>" + application +
"<BREAK>" + 
groupSpecArray[i];
   work.addAttributeValue("kpRacfGroup", newValue);
  }
 }
}

I will approach support with this too.  So the regex issues have been fixed?

Thanks for your help.

More later...

Z.


"Eddie Hartman" <eddie.hartman@no.ibm.com> wrote in message 
news:fjte9f$27o42$1@news.boulder.ibm.com...
> Hi Zareh,
>
> I test this code:
>
>    s = "this is a test of matching( with param )";
>    task.logmsg(s.match("matching\\(")[0]);
>
> in both 6.0 and 6.1.1 and got the same results:
>
> 09:15:55  matching(
>
> Perhaps you could clip in a larger section of the code
> in question so I could see the context of your match.
> Or you could take this straight to our L2 support gurus.
>
> -Eddie
>
> Zareh Movsessian wrote:
>> Hello,
>>
>> Is there a new way to get the following snippet of code to match an
open 
>> parenthesis "("?
>>
>> Array[i].match("\\("))
>>
>> After upgrading to IDI 6.1.1 on AIX, this piece of code no longer
matches 
>> a "(" and the flow falls into the wrong section of code in an
Override 
>> Lookup hook.
>>
>> Any ideas?
>>
>> Thanks in advance.
>>
>> More later...
>>
>> Z.
>>
>>
>>
>> 
Post Reply
about | contact