Does anyone have an example of how to use regexsplit
Douglas E. Engert
deengert at anl.gov
Thu Sep 27 17:19:37 EDT 2012
On 9/27/2012 12:29 PM, Leonard Kroll wrote:
> Hi all,
>
> I am having problems getting regexsplit to work.
> The problem is with the regular expression specified.
> I have a title attribute that looks like Faculty/pt and I want to pull off just the Faculty portion.
> I have tried a regex of ^(Staff|Student|Faculty) and it only works if the title is "Faculty". (exact match)
> If the title is "Faculty/pt" the regular expression does not match.
>
> The attribute values for title can be Student, Student/pt, Staff, Faculty and Faculty/pt, Faculty/do
>
> Also tried regex="^(\w*)"
Did you try regex="^(\\w*)"
>
> Not sure what to try next.
> Here is what my attribure defs look like:
>
> <resolver:AttributeDefinition xsi:type="ad:Scoped" id="eduPersonScopedAffiliation" scope="umb.edu"
> sourceAttributeID="SPLIT_TITLE">
> <resolver:Dependency ref="SPLIT_TITLE" />
> <resolver:AttributeEncoder xsi:type="enc:SAML1ScopedString"
> name="urn:mace:dir:attribute-def:eduPersonScopedAffiliation" />
> <resolver:AttributeEncoder xsi:type="enc:SAML2ScopedString" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.9"
> friendlyName="eduPersonScopedAffiliation" />
> </resolver:AttributeDefinition>
>
> <!-- -->
>
> <resolver:AttributeDefinition xsi:type="RegexSplit" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
> id="SPLIT_TITLE"
> sourceAttributeID="title"
> regex="^(Student|faculty|Faculty|Staff)" >
>
> <resolver:Dependency ref="myLDAP" />
>
>
>
> Christopher, thank you for getting me this far.
> I could not have done it without you.
>
> ~lennyK
>
> -----Original Message-----
> From: users-bounces at shibboleth.net [mailto:users-bounces at shibboleth.net] On Behalf Of Christopher Bongaarts
> Sent: Tuesday, September 25, 2012 4:12 PM
> To: users at shibboleth.net
> Subject: Re: Does anyone have an example of how to use regexsplit
>
> On 9/25/2012 12:52 PM, Leonard Kroll wrote:
>>
>> Hi, I need to split the title attribute. I want to pull "Student", "Staff" and "Faculty" off the beginning of the attribute.
>> i.e. "Faculty/pt", "Staff/ne", "Student/li"
>>
>> Does anyone have an example of regexsplit showing how to use it?
>
> No, but might be able to give some suggestions...
>
>> <resolver:AttributeDefinition xsi:type="ad:Scoped" id="eduPersonScopedAffiliation" scope="umb.edu"
>>
>> sourceAttributeID="title">
>
> I think you want sourceAttributeID="SPLIT_TITLE" if you want your ePSA to be based on the result of the splitting rather than the raw title attribute.
>
>> <resolver:Dependency ref="myLDAP" />
>
> I think you have your dependencies backward if you want ePSA based on the first part of the title. This one would be ref="SPLIT_TITLE".
>
>> <resolver:AttributeDefinition xsi:type="RegexSplit" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
>> id="SPLIT_TITLE"
>> sourceAttributeID="title"
>> regex="[Student][Faculty][Staff]">
>
> You need a Java 5 regex, with the first match group assigned as the value... something like:
>
> regex="^(Student|Faculty|Staff)"
>
>> <resolver:Dependency ref="eduPersonScopedAffiliation" />
>
> This one would ref="myLDAP".
>
--
Douglas E. Engert <DEEngert at anl.gov>
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444
More information about the users
mailing list