in reply to Extracting numbers from a text file

This produces the desired output for the input you showed:

perl -ple '$_=join",",/\d+/g' input.txt

But seriously, it seems like you're not telling us the whole story. Not only does this sound like homework, but your example input & output or specification don't indicate:

Technically, my example above solves the problem you posed, so if you want a regex that really works for you, you'll have to be a lot more specific.

Replies are listed 'Best First'.
Re^2: Extracting numbers from a text file
by PetreAdi (Sexton) on Nov 02, 2019 at 19:00 UTC

    I'm only getting the first occurrence in {start1}(0-9{2})${end1} (I want to store all matches in the next line)