How to get last few characters of varying length from a string ..?
<p>I have a multiple string urls, from which i have to pick last few characters, which are id's infact. But the problem is that, the length of id's is not consistent, i.e., if one id is of length 6 then, other may be of length 5 or 4 and so on. The sample urls are like:</p>

<pre><code>www.abc.com/xyz-123456
www.abc.com/pqr-5432
www.abc.com/lmn/opqr-25647
</code></pre>

<p>it could have been a lot easier if the length of the particular id portion would have been same, i could have used:</p>

<pre><code>String abc = "www.abc.com/xyz-123456"; 
String id = abc.substring(abc.length()-6);
</code></pre>

<p>But now the scenario is different as length of id portion in the selected url is not the same always, How can i cater this varying id..???? please any help is appreciated.</p>
