Python Forum
Regex Subdomain Validation & Input website manual
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex Subdomain Validation & Input website manual
#2
Well, re.compile("(https?://)?([^:^/]*)(:\\d*)?(.*)?") will only catch the http(s) if it is there, and will match example.com. It will also match subdomain.example.com, but all of that will be in the second group. Is that what you wanted or did you want the subdomain to be in a separate group?

As for asking for user input, that's easy:

url = input('Please input your website: ')
match = GRUBER_URLINTEXT_PAT.match(url)
if match is None:
    print('Invalid url.')
else:
    print('That url is valid.')
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Regex Subdomain Validation & Input website manual - by ichabod801 - Sep-16-2018, 03:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Shocked Manual Splines? Power_Broker 4 1,210 Nov-08-2022, 01:49 AM
Last Post: Power_Broker
  input data validation plumberpy 2 1,818 Aug-11-2021, 12:04 PM
Last Post: plumberpy
Question Input validation goes south. Gilush 6 2,725 Dec-04-2020, 12:18 PM
Last Post: Gilush
  py2 to py3 manual conversion, dictonaries Vysero 8 5,166 Jun-06-2018, 08:33 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020