Вот данные два сценария
Пример 1
the Image Path is https://ictagrisindh.gov.pk/img/inauguration1.jpg the detail goes here
and the url was this and Click here to view the detail goes here
Пример 2
https://ictagrisindh.gov.pk/img/inauguration1.jpg the detail goes here
Click here to view screenshot the detail goes here
Мой код приведен ниже
import re
str_text = "the Image Path is https://ictagrisindh.gov.pk/img/inauguration1.jpg the detail goes here and the url was this and Click here to view the detail goes here"
urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', str_text)
print("Urls: ",":".join(urls))
Результат
https://ictagrisindh.gov.pk/img/inauguration1.jpg
я хочу извлечь текст из начальной точки в конечную точку между ними, а также извлечь текст отовсюду в пути изображения
Любая помощь будет оценена и спасибо заранее