Regex in the SHibboleth2.xml

Rick Hoodenpyle rhoodenpyle at
Fri Apr 29 19:48:35 UTC 2022

Hello again Christopher,

Thank you so much. The code you provided worked perfectly.



*From:* users <users-bounces at> *On Behalf Of *Christopher
Bongaarts via users
*Sent:* 29 April 2022 20:12
*To:* users at
*Cc:* Christopher Bongaarts <cab at>
*Subject:* Re: Regex in the SHibboleth2.xml

On 4/29/2022 2:05 PM, Rick Hoodenpyle wrote:

I often have to separate username from the email address using the

<!--<AttributeResolver type="Transform" source="upn">

              <Regex match="^(.+)@(.+)$" <%5e(.+)@(.+)$>

              <Regex match="^(.+)@(.+)$" <%5e(.+)@(.+)$>


I have a client though that passes an ID through the UID attribute. It
begins with a letter K and ends with the numerical ID, example K98456.

The value that this must equate to in my application is a numerical only
value, so I am needing to find out how to remove the K and only pass the
numbers. I have thought about maybe using the following, but have not had a
chance to test it and was wondering if someone out there might already know
how to do this.

<!--<AttributeResolver type="Transform" source="uid">

              <Regex match="^(.+)[0-9](.+)$" dest="kuid">$1</Regex>


Given K followed by numbers, and extracting just the numbers, you would use
something like:

<Regex match="^K([0-9]+)$" dest="kuid">$1</Regex>


%%  Christopher A. Bongaarts   %%  cab at          %%

%%  OIT - Identity Management  %%  %%

%%  University of Minnesota    %%  +1 (612) 625-1809    %%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list