Extract Code from a Text File

Hi there,

I’d like to extract a Code from a Text File.

Example:
1 Prosecco Porta Leone 0514741 Prosecco Porta Leone 0514741 Prosecco Porta Leone 051474

Result:
0514741, 0514741, 051474

Is this even possible?

Thank you for your help!!!

Cheers
Marth

set theText to "1 Prosecco Porta Leone 0514741 Prosecco Porta Leone 0514741 Prosecco Porta Leone 051474"
set theList to words of theText
set theNumbers to {}
repeat with aWord in theList
	try
		set x to aWord as integer
		set end of theNumbers to contents of aWord
		log aWord
	end try
end repeat
theNumbers --> {"1", "0514741", "0514741", "051474"}
rest of theNumbers --> {"0514741", "0514741", "051474"}

This will yield yucky results when the numbers contain characters that are seen as interpunction by AppleScript.
When they always look like in your example it should be safe, though.

Thank you very much! Works perfect!