RegexSplit resolver returning no values

Bellina, Brendan bbellina at ucla.edu
Fri Jan 29 12:04:55 EST 2016


That regex grabs all digits at the start of a string until there is a
non-digit character or end of string.  It is not limited to length 5. If
the string only contains digits then the last digit will be dropped.

So while your example “12345 some text 12/01/17” does return “12345” as
you wished you should be aware that:

"12 345 some text 12/01/17” would return only “12” - fewer than 5 digits.
“123456789 some text 12/01/17” would return “123456789” - more than 5
digits.
“12345” would return “1234” - fewer than 5 digits.

You can verify these results at https://regex101.com

Regards,

Brendan Bellina
Identity Mgmt. Architect, IT Services, UCLA
✉ bbellina at ucla.edu   ☏ +1 310 206 3131


On 1/29/16, 7:51 AM, "users on behalf of Morris, Andi"
<users-bounces at shibboleth.net on behalf of amorris at cardiffmet.ac.uk> wrote:

>Hi Tom,
>That's done it! I'm curious why my regex didn't work, but yes that does
>seem to now be passing the correct string across. Thanks.
>
>I do see this message regarding the encoding, I just copied the encoding
>from another attribute resolver so I guess it doesn't work with
>regexsplit. Is this likely to cause any issues?:
>-------------------------------------
>Removing attribute PersonalRef, it can not be encoded via
>edu.internet2.middleware.shibboleth.common.attribute.encoding.SAML2NameIDE
>ncoder
>--------------------------------------
>
>My resolver config now looks like:
>
><resolver:AttributeDefinition xsi:type="RegexSplit"
>xmlns="urn:mace:shibboleth:2.0:resolver:ad"
>                              id="PersonalRef"
>                              sourceAttributeID="description"
>                              regex="^([0-9]+) .+$">
><resolver:Dependency ref="myLDAP" />
>
>         <resolver:AttributeEncoder
>            xsi:type="SAML1String"
>            xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>            name="PersonalRef" />
>
>     <resolver:AttributeEncoder
>            xsi:type="SAML2String"
>            xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>            name="PersonalRef"
>            friendlyName="PersonalRef" />
>
></resolver:AttributeDefinition>
>
>Cheers,
>Andi
>
>-----Original Message-----
>From: users [mailto:users-bounces at shibboleth.net] On Behalf Of Tom Scavo
>Sent: 29 January 2016 14:54
>To: Shib Users <users at shibboleth.net>
>Subject: Re: RegexSplit resolver returning no values
>
>On Fri, Jan 29, 2016 at 5:42 AM, Morris, Andi <amorris at cardiffmet.ac.uk>
>wrote:
>>
>> The attribute is declared as:
>>
>> <resolver:AttributeDefinition xsi:type="RegexSplit"
>>xmlns="urn:mace:shibboleth:2.0:resolver:ad"
>>                               id="PersonalRef"
>>                               sourceAttributeID="description"
>>                               regex="(\d{5})"> <resolver:Dependency
>> ref="myLDAP" />
>>
>> </resolver:AttributeDefinition>
>>
>> I need to grab the first 5 digits from a string, an example of which is
>>below:
>>
>> 12345 some text 12/01/17
>>
>> Can anyone advise please?
>
>Try: "^([0-9]+) .+$"
>
>but I'm not sure if this regex is appropriate for "RegexSplit".
>
>Tom
>--
>To unsubscribe from this list send an email to
>users-unsubscribe at shibboleth.net
>________________________________
>
>[Cardiff Metropolitan University - 150 years of nurturing
>talent]<http://www.cardiffmet.ac.uk/cardiffmet150>
>-- 
>To unsubscribe from this list send an email to
>users-unsubscribe at shibboleth.net



More information about the users mailing list