This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap'); | |
| * { | |
| font-family: "JetBrains Mono", monospace!important; | |
| font-optical-sizing: auto; | |
| border-radius: 0px!important; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getDomainsFromString(stringWithUrls) { | |
| const whitelist = ["openai.com", "stackoverflow.com"]; | |
| const urlRegex = /https?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/g; | |
| const urls = stringWithUrls.match(urlRegex); | |
| const domains = urls.map(url => { | |
| const domainRegex = /(?<domain>[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})/; | |
| const domain = url.match(domainRegex).groups.domain; | |
| return domain; | |
| }); | |
| const filteredDomains = domains.filter(domain => whitelist.includes(domain)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| def get_domains_from_string(string_with_urls): | |
| whitelist = ["openai.com", "stackoverflow.com"] | |
| urls = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', string_with_urls) | |
| domains = [re.search("(?P<domain>[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,})", url).group("domain") for url in urls] | |
| filtered_domains = [domain for domain in domains if domain in whitelist] | |
| return filtered_domains |