0

I'm kind of new to python and I want to check if a given string is a social network valid url or not.

A vaild url is something like this:

[Social Network Name]:www.[domain]/[Account Name]

And these conditions:

  1. Social network name is a captalize word
  2. Domain only contains lowercase letters and a dot (.)
  3. Account name has letters, numbers or underline (_)

For example:

Twitter:www.twitter.com/blahblah
True
Rman
  • 7
  • 2
  • 2
    Looks like you are looking to create a regex, but do not know where to get started. Please check [Reference - What does this regex mean](https://stackoverflow.com/questions/22937618) resource, it has plenty of hints. Once you get some expression ready and still have issues with the solution, please edit the question with the latest details and we'll be glad to help you fix the problem. Note: pay special attention to "Common Tasks" in the linked thread. – Wiktor Stribiżew Jun 21 '19 at 10:22
  • I am not a regex expert, but something like this, you could extend for your needs: `^(Twitter|Facebook|Google):w{3}.[a-z]*.[a-z]*\/[a-z]*`. Just try a little bit on [regex101](https://regex101.com/). – Habebit Jun 21 '19 at 11:06

0 Answers0