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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -