What kind of regex does the Transform AttributeResolver use?

Ferenc Wágner wferi at niif.hu
Sat Jul 28 12:42:28 EDT 2018


Hi,

While experimenting with transforming attributes under SP 2.6, I found
that the following two transformations don't behave the same:

<AttributeResolver type="Transform" source="eppn">
    <Regex match=".+" dest="fakeEntitlementPlus">viewers</Regex>
    <Regex match=".*" dest="fakeEntitlementStar">viewers</Regex>
</AttributeResolver>

When fed by an arbitrary eppn, the .+ rule creates
fakeEntitlementPlus=viewers as expected, while the .* rule creates an
empty fakeEntitlementStar and logs the message:

2018-07-28 17:39:24 ERROR Shibboleth.AttributeResolver.Transform [6]: caught error applying regular expression: replace pattern cannot match zero-length string

I don't understand this error message: why would a replace pattern match
anything?  Now, is this an unusual regular expression syntax here or
some other problem?  Also, what syntax does the replacement part expect?
Backslashes have to be doubled, backreferences are $1, $2 and so on.  Is
there anything more to know?

(I was also got by the operation being applied repeatedly/globally:
match="." resulted in viewersviewersviewersviewers... to my surprise.)
-- 
Thanks,
Feri


More information about the users mailing list