1

I now understand that a similar question has been asked, but not everyone might come to the adapted solution for this version of the question straight away.

Is there a simple way to count the number of occurrences of every group of numbers in a string? I can't think of one and anything I can think of seems way too convoluted, for what seems like a simple ish task.

(note that any string of numbers in the line could be any length)

Example input:

AGTHDTGY35AHSJFHHFG7GHHAHH

Example output:

2
Giles
  • 897

1 Answers1

1

You could do this in a Perl-ish way as shown:

$ perl -lpe '$_ = s/\d+//g'
  2