Q:

How to check the user's link to an account with two domain names?

How to validate user profile URL with two domain names. For example, there are sites that are available from some domains. The same site opens with many domain names. For example I can visit to https://website.com with https://wb.com too. In this case URL's to user profiles can be with two domains:

https://website.com/username
https://wb.com/username

I can individually check these domains with two different patterns:
For: https://website.com/username
(?:(?:http|https):\/\/)?(?:www.)?website.com\/(?:(?:\w)*#!\/)?([\w\-]*)?

For: https://wb.com/username
(?:(?:http|https):\/\/)?(?:www.)?wb.com\/(?:(?:\w)*#!\/)?([\w\-]*)?

How to create a single template to check the link to the user profile?

A:

Using alternation to match website or wb, and refactoring the regex to remove unnecessary groups and such, you can use:
(?:https?:\/\/)?(?:www\.)?(?:wb|website)\.com\/(?:\w*#!\/)?([\w-]*)?

Note that because . matches any character, you need to escape it with a \ in front.
https://regex101.com/r/BCbmEw/1
Separated out:
(?:https?:\/\/)?
(?:www\.)?
(?:wb|website)\.com\/
(?:\w*#!\/)?
([\w-]*)?

