0

Long time lurker, first time poster :-)

I have an issue where our vendor does not appear to accept special characters such as hyphen (-) and apostrophes ('). Is that the plural?

So in our Azure Active Directory SAML claim I need to remove the hyphens and apostrophes and bunch it all up together to send as the claim.

I am having an issue trying to get this RegEx Replace to work.

If a user has a hyphen or apostrophe in their email address, it needs to be removed when sending the claim.

Example Email Claim:

BobSacamento-Williams@company.com

Example Expected Transform Claim / Output:

BobSacamentoWilliams

Current Settings:

Transformation:

RegExReplace ()

Attribute:

user.mail

Regex Pattern:

(?'mail'^.*?)(?i)(@.*)$

Replacement Pattern:

{mail}

Current Output:

BobSacamento-Wiliams

I am not sure where to use

[^-'] 

in the RegEx Pattern portion to extract everything except the hyphen and apostrophe or if I should create a secondary transformation to correct the primary output. Microsoft does not appear to be using any syntax that makes sense from other websites and their documentation is terrible.

If you can PM me the solution I can make it worthwhile via crypto. I am willing to pay. I am up against a wall here.

I tried Example Email Claim (Input):

BobSacamento-Williams@company.com

Regex Pattern:

(?'mail'^.*?)(?i)(@.*)$

and received:

Current Output:

BobSacamento-Wiliams

but I expect/need to remove the hyphens and apostrophes and join like: BobSacamentoWilliams

1 Answers1

0

You can use the following regex and replace it with empty string.

[-_`]|(@.*)

It is picking up all unwanted characters like underscore, hyphen etc, also it is eleminating domain name, so the only thing you left with is just "BobSacamentoWiliams". Check snapshot below

enter image description here