HOW TO CHECK IF A STRING CONTAINS URL OR NOT…
PLEASE PROVIDE ME THE URL SCHEME SO THAT WE CAN FIND OUT THAT A STRING CONTAINS URL OR NOT…
thankyou…
HOW TO CHECK IF A STRING CONTAINS URL OR NOT…
PLEASE PROVIDE ME THE URL SCHEME SO THAT WE CAN FIND OUT THAT A STRING CONTAINS URL OR NOT…
thankyou…
Try this:
import re
def is_url(url):
expr = r'^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
if re.match(expr, url):
return True
else:
return False
is_url('https://www.google.com')
IT’S not working…!!
I tested it before posting.
Could you show me the screenshot of ‘not working’?