Help for this page

Select Code to Download


  1. or download this
    my $string = "testing, testing, 123";
    my @captured = ($string=~/(testing)/g);
    print "captured: $_\n" for @captured;
    
  2. or download this
    # match lowercase letters commas and space and get as many as possible
    + (greedy)
    $string=~/([a-z,\s]+)/; 
    
    # same but non-greedy (stop as soon as you can)
    $string=~/([a-z,\s]+?)/;