RegEx should have a modifier + like this
^address_edit/(\d+)/$
Quote from Python RegEx Documentation ,
'+'
Makes the resulting RE match 1 or more repetitions of the previous RE. ab+ will match a followed by any nonzero b s; he will not only match a .
\d will match any numeric digit ( 0-9 ). But it will only match once. To combine it twice, you can either do \d\d . But as the number of digits to receive increases, you need to increase the number \d s. But RegEx has an easier way to do this. If you know the number of digits to accept, you can do
\d{3}
This will take three consecutive numeric digits. What if you want to accept 3 to 5 digits? RegEx has coverage.
\d{3,5}
Simple, yes? :) Now it will only accept 3 to 5 numeric digits (Note: anything less than 3 will also not match). Now you want to make sure that the minimum is 1 digital digit, but the maximum can be any. What would you do? Just leave the range open, like this
\d{3,}
Now the RegEx mechanism will correspond to a minimum of 3 digits, and the maximum can be any number. If you want to combine at least one digit and a maximum, there can be any number, then what would you do
\d{1,}
That's right :) Even that will work. But we have an abbreviation to do the same, + . As mentioned in the documentation, it will match any nonzero number of digits.
source share