Say there are two words like: googleweb.us and google.us
This is one way I worked out to match these in a single regex, but it looks ugly.
/(google|espn|foxtel)\w*[web\.\w+|\.\w+]/
I only want to cover both of the two cases when “web” exists or not. How could the pattern could be improved?
This will allow “web” to be optional for just google:
This will allow “web” to be optional for any of the domains: