fork download
  1. import re
  2. regex = r"""(?x)
  3. \d+ # Digits
  4. \D+ # Non-digits up to...
  5. $ # The end of string
  6. """
  7. print(re.search(regex, "My value: 56%").group(0))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
56%