@Override
    public String transform(final String username) {
        val matcher = pattern.matcher(username);
        if (matcher.find()) {
            return matcher.group(1);
        }
        return username.trim();
    }
A transformer that extracts the principal by a provided regex pattern.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/transforms/RegexPrincipalNameTransformer.java