fork(2) download
  1. import re
  2. p = re.compile(r'<a\s+href\s*=\s*"([^"]+).*')
  3. test_str = ["My website is <a href=\"WEBSITE1\" target='_blank'><u>WEBSITE1</u></a>", "The link is <a href=\"LINK1\" target='_blank'><u>LINK1</u></a>"]
  4.  
  5. for x in test_str:
  6. print(re.sub(p, r"\1", x))
Success #stdin #stdout 0.04s 9984KB
stdin
Standard input is empty
stdout
My website is WEBSITE1
The link is LINK1