I have a string (an email address) str = '[email protected]'
I have an array with a list of domains : arr = ['randomain.com', 'test.com', 'support.com']
I need to return true if my string's domain is a part of the array or if its a subdomain of a domain in the array. Return false if the domains are not related.
So far I have tried the in function on the array as a whole and in function while iterating through the elements of the array. Both dont give the right value.
You need to perform regular expression pattern matching against all array members, like this:
You need to install measures for case‑insensitive matching, but that’s beside the issue here.