fork download
  1. import re
  2. l = 'https://'+'homepage.com/home/page1/222.6 a_type-A/go'
  3. replace_with = '222.6'
  4. # https://h...content-available-to-author-only...e.com/home/page1/222.6_type-A/go
  5. print (re.sub('(page1/).*?(_type-A)',fr'\g<1>{replace_with}\2',l, flags=re.DOTALL))
Success #stdin #stdout 0.03s 9484KB
stdin
Standard input is empty
stdout
https://h...content-available-to-author-only...e.com/home/page1/222.6_type-A/go