Help for this page

Select Code to Download


  1. or download this
    $s = '1 23 456 789 01 23 456';
    my ($d1, $d2, $d3, $d4, $d5, $d6, $d7) = $s =~ m/(\d+)/g;
    print "$d1, $d2, $d3, $d4, $d5, $d6, $d7\n";
    # Prints: 1, 23, 456, 789, 01, 23, 456
    
  2. or download this
    @results = $s =~ m/(\d+)/g;
    $i = 1;
    ...
    # $d5: 01
    # $d6: 23
    # $d7: 456
    
  3. or download this
    $s = '1 23 456 789 01 23 456';
    push @results, $1 while $s =~ /((?:\b\d{1,2} )+\b\d{3,})/g;
    ...
    # Prints:
    # Match: 1 23 456
    # Match: 01 23 456