# Autodiscovering User Accounts for OneDrive for Business Using Regular Expressions or Wildcards

You can use regular expressions or wildcards to autodiscover user accounts by UPN. For example, you can use regular expressions to discover all user accounts that contain "sales" in their UPN. The regular expressions that you use are case sensitive.

When you use regular expressions or wildcards to autodiscover user accounts, user accounts that match the regular expressions or the wildcard pattern are automatically assigned to the user-defined user group for which you enter the regular expressions or wildcards. If a user account does not match the expressions, then it is automatically assigned to the default user group.

Regular expression | What the regular expression matches | Examples of UPN that match the regular expression
--- | --- | ---
Sales* | UPN that begin with "sales" followed by any number of any characters | SalesA SalesOffice
[JT]im* | UPN that begin with "J" or "T", followed by "im", and then followed by any number of any characters | Jim@xyz.abc Tim@xyz.abc
[a-k]Lee* | UPN that begin with any character in the range of "a" through "k" inclusive, followed by "Lee", and then followed by any number of any characters | aLee@xyz.abc bLee@xyz.abc
[A-Z]*[ ][A-E][A-Z]* | To skip the entire first name, find the first space and then discover users with last name beginning with the letters "A" through "E". |

## Before You Begin

Enable autodiscovery of user accounts, and then select Regex patterns. For more information, see Enabling Autodiscovery of User Accounts.

## Procedure

1. From the Command Center navigation pane, go to Protect > Microsoft 365.

   The Microsoft 365 Overview page appears.

2. On the Apps tab, click the OneDrive for Business app.

   The app page appears.

3. On the User groups tab, update an existing user group or create a user group:

   - To add regular expressions to an existing user group, right-click the user group, and then select Manage.

     The user group page appears.

   - To add regular expressions to a new user group, in the upper-right corner of the page, click Add user group.

     The Add user group page appears.

4. On the Regex patterns tab, click Add pattern.

   The Add new content dialog box appears.

5. In the Regular expression box, type a regular expression or wildcard pattern, and then click Add.

   You can enter multiple regular expressions or wildcard patterns.

6. Click Save.

## What to Do Next

Run a backup operation on this user-defined user group to back up all the user accounts that have UPN that match the regular expressions or the wildcard patterns that you entered.

×

Loading...