DEV Community

Discussion on: Python Regex help?

Collapse
 
derekenos profile image
Derek Enos

If that first character is only ever going to be a single 'R', you can replace the [R]+ in the regex with just R:

>>> re.findall(r'R\d+\.?\d*', 'R31.99Save\xa05.00')
['R31.99']

Any character in the pattern that doesn't have some special regex meaning will match the character itself.