In that case:
echo "$XXX" | perl -ne '/\/(\w+)[^\/]*?$/ and print $1' [download]
In reply to Re^3: matching substring in url by hippo in thread matching substring in url by cioperl