Extract digits at end of string

I have a string like xxxxxx44. What's the best way to extract the digits (one or more) in a ksh script?

Thanks

can u elaborate your question /provide some sample input.
what do u want to do exactly?

Try...

var1="xxxxxx44"
var2=$(expr $var1 : "[^0-9]*\([0-9]*\)")

Extraction of the trailing digits :

var=xxxxx44
digits=${var#${var%%*([0-9])}}

Jean-Pierre

how about this,

echo "abcde444" | sed 's/[a-z]//g'

Ygor and matrixmadhan, your solutions works fine, but only if the trailing digits are prefixed by non digit characters.

For example :

var="xxx1xxx44"
expr $var1 : "[^0-9]*\([0-9]*\)"   # => Gives 1
echo $var1 | sed 's/[a-z]//g'        # => Gives : 144

Jean-Pierre.

Thanks - that's just what I was trying to do.

Thanks all for your replies