Compare a number of email addresses and check their domains against one you are filtering for via a regular expression.
The following Google Apps Script is designed to use a regular expression (regex) to confirm if an email address domain matches one we specify eg: @hotmail.co.uk, @gmail.com, @outlook.com
I developed the code so I could screen email addresses to make sure they only came from within the institution – otherwise it would have broken the tool I was developing for creating Zoom meetings. The email addresses in this example are all stored in one cell in a Google Sheet and are separated via a comma and a single space.
Source: The Gift of Script: Check the domain of an email address by regex
I use Google Apps Script to support staff and students in my job. I enjoy dabbling with creating tools to help with automation and I freely share my learning experiences on my blog, where I also have a number of useful Google Add-ons: www.pbainbridge.co.uk
For Google Sheets formula/function fans you can achieve something similar with
=ARRAYFORMULA({TRANSPOSE(SPLIT(A2,", ")),REGEXMATCH(TRANSPOSE(SPLIT(A2,", ")),"@random.com")})