0

I'm new to regular expressions. I've been trying to write one, though, to retrieve a web adress, but it does not work and I don't know what I'm doing wrong..

pat = re.compile(r"^[Ww]*\.(.)((com)$)")

Can you please tell me what's wrong with this pattern?

Thanks in advance!

Jan
  • 42,290
  • 8
  • 54
  • 79
Sara
  • 97
  • 6
  • What is the exact problem you are trying to solve, because if you are trying to extract parts of a URL, this can be done already using [urlparse](https://docs.python.org/3/library/urllib.parse.html) – idjaw Mar 04 '18 at 12:54
  • Your re is wrong, and you should write this by hand, use some lib. https://stackoverflow.com/questions/6883049/regex-to-find-urls-in-string-in-python – scriptboy Mar 04 '18 at 12:57
  • I know it is wrong. That's why I asked the question. I do not know "what" is wrong, though. Can you comment on what I wrote please? because I've gotten a bit confused on the web; seeing others' problems. I can't think clearly. – Sara Mar 04 '18 at 13:26
  • I don't know why you close questions assuming I have not already checked other threads. I have. They didn't get me anywhere with what I'm doing wrong here in this line. Thanks for your patience and arrogance! I really appreciate it. – Sara Mar 04 '18 at 13:32

0 Answers0