Does anyone have an example of how to use regexsplit
Leonard Kroll
Leonard.Kroll at umb.edu
Thu Sep 27 14:31:25 EDT 2012
Ok
If I am understanding the regexsplit documentation page correctly .....
After applying the regular expression, "group(0) is returned as the result.
Is this correct, because I am not getting "Faculty" returned as the attribute value.
I get this line in the logs:
14:21:34.789 - DEBUG [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefini
tion.RegexSplitAttributeDefinition:73] - Value Faculty/pt did not result in any values when split by regular
expression [a-zA-Z]*
On your test page it worked:
Test Results
Regular Expression
([a-zA-Z]*)?
as a Java string
"([a-zA-Z]*)?"
Replacement
groupCount()
1
Test
Target String
matches()
replaceFirst()
replaceAll()
lookingAt()
find()
group(0)
group(1)
1
Faculty/pt
No
/pt
/
Yes
Yes
Faculty
Faculty
next find()
Yes
next find()
Yes
pt
pt
next find()
Yes
How does attribute regexsplit work???
Does it return group(0)?
~lennyK
-----Original Message-----
From: users-bounces at shibboleth.net [mailto:users-bounces at shibboleth.net] On Behalf Of Paul Hethmon
Sent: Thursday, September 27, 2012 1:37 PM
To: Shib Users
Subject: Re: Does anyone have an example of how to use regexsplit
Leonard,
I don't have an exact solution but since that expression gets compiled into a Java regex object, you might try using one of the online Java regex sites. This is one I like:
http://www.regexplanet.com/advanced/java/index.html
It just gives an easy way to fine tune the expression quickly.
Paul
On 9/27/12 1:29 PM, "Leonard Kroll" <Leonard.Kroll at umb.edu<mailto:Leonard.Kroll at umb.edu>> 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*)"
>
>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>
>[mailto:users-bounces at shibboleth.net]<mailto:[mailto:users-bounces at shibboleth.net]>
>On Behalf Of Christopher Bongaarts
>Sent: Tuesday, September 25, 2012 4:12 PM
>To: users at shibboleth.net<mailto: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".
>
>--
>%% Christopher A. Bongaarts %% cab at umn.edu<mailto:cab at umn.edu> %%
>%% OIT - Identity Management %% http://umn.edu/~cab %%
>%% University of Minnesota %% +1 (612) 625-1809 %%
>--
>To unsubscribe from this list send an email to
>users-unsubscribe at shibboleth.net<mailto:users-unsubscribe at shibboleth.net>
>
>
>--
>To unsubscribe from this list send an email to
>users-unsubscribe at shibboleth.net<mailto:users-unsubscribe at shibboleth.net>
--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net<mailto:users-unsubscribe at shibboleth.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20120927/85375ee6/attachment-0001.html
More information about the users
mailing list