python - regex match last occurence -


I'm trying to find ways other than these two:

  # this In case \ d +, match the last 24242 & gt; & Gt; & Gt; Test = "123_4242_24242lj.:" & Gt; & Gt; & Gt; Obj = re.search (r "\ d + (?!. * \ D)", test) & gt; & Gt; & Gt; Obj.group () '24242' & gt; & Gt; & Gt; Re.findall (r "\ d +", test) [- 1] '24242'   

Any ideas?

This lookahead based regex matches the previous issue in a single digit:

  \ D + (? = \ D * $)    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -