The default strings is:
strings123[abc123def456]strings456
Add tag for number:
strings[abc<span>123</span>def<span>456</span>]strings
The default strings is:
strings123[abc123def456]strings456
Add tag for number:
strings[abc<span>123</span>def<span>456</span>]strings
Search by this:
(\d+)
and replace by :
<span>\1</span>
Regex Demo
Sample Source:
import re
regex = r"(\d+)"
test_str = "strings[abc123def456]strings"
subst = "<span>\\1</span>"
result = re.sub(regex, subst, test_str, 0)
if result:print (result)