python string match http 1

python string match http

re.findall(r'https?://[^\s<>"]+|www\.[^\s<>"]+', str(STRING))

Here is what the above code is Doing:
1. The first line of code is importing the re module.
2. The second line of code is defining a variable named STRING.
3. The third line of code is defining a variable named LINKS.
4. The fourth line of code is using the re.findall() function to find all the URLs in the STRING variable.
5. The fifth line of code is printing the LINKS variable.

Similar Posts