Using the correct expression and replacement using the widespread regular expressions language, you should be able to transform usernames as long as they follow some consequent pattern. If your incoming username is email@example.com and you would like to have it converted to firstname.lastname@example.org, a regular expression could help you solve this.
One way of doing this is dividing the incoming username into groups by using this expression:
the parentheses are creating the groups
period "." indicates any symbol
star "*" means from 0 to many occurrences of the preceding symbol
The five groups can then be used as the replacement to create the new username. Each group is getting a numeral, incremental name where their name and value in the given example would be:
$1 = "jon.doe"
$2 = "_"
$3 = "teacher"
$4 = "@"
To create a new username as an output, use the variables and other symbols to build the replacement. In the given example, having the replacement set to $1$4$5 will transform from email@example.com to firstname.lastname@example.org.
Change case of username
When using just-in-time provisioning and regular expressions for username lookup, you may want to control what case usernames get. By using \L (lowercase) and \U (uppercase) in front of $1 and other replacements (see above examples), you may instruct what case the username for the newly created user will be.
So for example, if you want the domain to have uppercase for created usernames, use the expression:
and then instruct all after @ symbol to be uppercase with this replacement:
Performing case-insensitive searches
By adding (?i) in the beginning of your transformation you will get case-insensitive searches. So if your transformation is (?i)(.*)@example.com this will both match all case versions of the domain name like email@example.com, john.doe@Example.Com and john.doe@EXAMPLE.COM.