#! /usr/bin/env python # -*- coding: utf-8 -*-# import re s = "你好2021" content = re.sub(r"(S+?)(d+)", r"**1** ##2##", s) print(content)