I could try to start - this is not complete or tested:

/tokenise $read(whatever you read from the file)
/var %numtoks = $0
/var %notfound = $true
/var %counter = 1

while ( (%notfound) && ( %counter <= %numtoks))
{
if (<some regex command to return a digit using $left( [ $ $+ %counter ], 1 ) > ) {
%found = $true
}
inc %counter
}
dec %counter
set %the_name $1- $+ %counter

Cheers,

DK