python regex: get end digits from a string

前端 未结 7 686
予麋鹿
予麋鹿 2020-12-08 20:29

I am quite new to python and regex (regex newbie here), and I have the following simple string:

s=r\"\"\"99-my-name-is-John-Smith-6376827-%^-1-2-767980716\"\         


        
7条回答
  •  借酒劲吻你
    2020-12-08 20:35

    Use the below regex

    \d+$
    

    $ depicts the end of string..

    \d is a digit

    + matches the preceding character 1 to many times

提交回复
热议问题