Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,165,255 members, 7,860,586 topics. Date: Friday, 14 June 2024 at 01:03 PM |
Nairaland Forum / Science/Technology / Programming / Regex To Get Domain Name From Url (264 Views)
How To Remove Category From URL Permalink / Get Wordpress Website/blog With Free Domain Name, Hosting At 5k / What Is The URL For Jumia Seller Centre API (2) (3) (4)
Regex To Get Domain Name From Url by 3exe3: 10:18am On Mar 28, 2023 |
"(http(s):\/\/)?(www\.)?([a-zA-z]+\.){0,}(\w)+)" this is the regex i wrote but i have no match if i do example.com ab.example.com www.example.com 1 Like |
Re: Regex To Get Domain Name From Url by truthCoder: 1:52pm On Mar 28, 2023 |
3exe3: ^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+) Explanation: ^ matches the beginning of the string (?:https?:\/\/)? is a non-capturing group that matches http:// or https:// if they are present (?:[^@\n]+@)? is a non-capturing group that matches the username and password (if any) that might be present in the URL (?:www\.)? is a non-capturing group that matches the www. prefix (if any) ([^:\/\n]+) is a capturing group that matches the domain name, which is any sequence of characters that are not a colon (, a forward slash (/), or a newline character (\n) Source: chatGPT Test this and revert. 1 Like |
Re: Regex To Get Domain Name From Url by airsaylongcome: 4:28pm On Mar 28, 2023 |
truthCoder: I swear CGPT is like cheat mode in a game. I love it. 3 Likes |
Re: Regex To Get Domain Name From Url by 3exe3: 5:32pm On Mar 28, 2023 |
truthCoder: |
Re: Regex To Get Domain Name From Url by truthCoder: 5:48pm On Mar 28, 2023 |
airsaylongcome:I swear. |
(1) (Reply)
My New PHP Course Is Approved On Aqskill / If You Say This During Your Job Interview, You're Will Get Hired! / Flutter Developer Hub
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |