<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Regex Problems
1. Efficiently Get a list of all complete URLs that use https protocol
Step1:  2. Get domains (without protocols) (including extension, e.g. .com) for URLs with both http and https protocols.
Step2:  3. Below is a list of language codes. Determine how many are some form of English
English codes will start with En, en, or EN
Step3:  4. Fix all langauge codes so that they are formatted as such
<ASSISTANT_TASK:>
Python Code:
urls = ['http://www.domain.com',
        'https://somedomain.com',
        'http://my-domain-123.net',
        'https://google.com',
        'http://www.foo.com',
        'https://bar-baz3.com',
        'ftp://domain2.com']
import re
# A complete match checking for the presence of some alphanumeric after the // followed
# by at least one group of .alphanumeric could be 'https://\w+(.\w+)+'
# I don't check if it ends with .com, .net or others but there are too many options here
[m.string for u in urls for m in [re.search('https://', u)] if m]
Explanation: Regex Problems
1. Efficiently Get a list of all complete URLs that use https protocol
End of explanation
[m.group(1) for u in urls for m in [re.search('https?://(\w+(.\w+)+)', u)] if m]
Explanation: 2. Get domains (without protocols) (including extension, e.g. .com) for URLs with both http and https protocols.
End of explanation
languages = ['Ar','It','it','En','En_gb','jp','en_GB','EN_IE','en-NZ','en','es','ES-es']
sum([1 for c in languages for m in [re.search('^en', c, re.IGNORECASE)] if m])
Explanation: 3. Below is a list of language codes. Determine how many are some form of English
English codes will start with En, en, or EN
End of explanation
[m.group(1).lower() + ('-' + m.group(4).upper() if m.group(2) else '')\
 for c in languages for m in [re.search('(^[A-Za-z]{2})((.)([A-Za-z]{2}$))?', c)] if m]
Explanation: 4. Fix all langauge codes so that they are formatted as such:
first two letters are lower case
codes with region endings use hyphen and not underscore
the region endings are upper case
End of explanation
<END_TASK>