如何使用正则表达式在特殊字符后获取数字

How to get numbers after special character using regex

import re
string = "He go 0 and umm go 6.33. His ssn number:987-645-33 and the got credit:973647 with 155 percent discount "
a = re.findall(r"(?:(?<=ssn number:)|(?<=credit:)|(?<=$))[\w\d-]+",string)
print(a)

Required solution:['0','6.33','987-645-33','973647']

是否有使用正则表达式获取 $ 值的解决方案。 $ 符号应该添加到 list

这是一个也包含美元金额的版本:

import re
string = "He go 0 and umm go 6.33. His ssn number:987-645-33 and the got credit:973647 with 155 percent discount "
a = re.findall(r"(?:(?<=ssn number:)|(?<=credit:)|$)\d+(?:[.-]\d+)*", string)
print(a)  # ['0', '6.33', '987-645-33', '973647']