fork download
  1. import re
  2. regex = r'\bsrcset="[^"]* (https?://\S+)\s+1200w"'
  3. test_str = """srcset=\"https://c...content-available-to-author-only...g.co/w/articles/1/5ca/f022bb06dc.png 150w, https://c...content-available-to-author-only...g.co/w/articles/2/5ca/f022bb06dc.png 300w, https://c...content-available-to-author-only...g.co/w/articles/3/5ca/f022bb06dc.png 600w, https://c...content-available-to-author-only...g.co/w/articles/4/5ca/f022bb06dc.png 1200w\""""
  4.  
  5. matches = re.search(regex, test_str)
  6. if matches:
  7. print(matches.group(1))
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
https://c...content-available-to-author-only...g.co/w/articles/4/5ca/f022bb06dc.png