需求

s = 'http://utf8.api.smschinese.cn/?Uid=negopk&Key=xxxooo&smsMob=16666666666&smsText=验证码:8888'

替换字符串s中的negopk

方法(python版)

pattern = re.compile('(?<=Uid=).*?(?=&)')
ret = pattern.sub('python', s)  # 将字符串中匹配的部分替换为python
print(ret)

结果

http://utf8.api.smschinese.cn/?Uid=python&Key=xxxooo&smsMob=16666666666&smsText=验证码:8888

 

相关文章:

  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
  • 2021-11-12
猜你喜欢
  • 2022-01-31
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案