Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my @group2 = ('E','F','G','H');
    my $string="DEAB CDGHEF";
    print "Match: $1\n" while $string =~ /([@group1]{4})/g;
    
  2. or download this
    local $" = '';
    
  3. or download this
    my @group1 = ('A','B','C','D');
    my $char_class1 = join "", @group1;
    my $string="DEABCDGHEF";
    print "Match: $1\n" while $string =~ /([$char_class]{4})/g;
    
  4. or download this
    use strict;
    use warnings;
    ...
    local $" = '';
    print "Match: $1\n" while $string =~ 
        /([@{[@group1[0..2],@group2[2,3]]}]{5})/g;
    
  5. or download this
    use strict;
    use warnings;
    ...
    my $string="DEABCDGHEF";
    my $group = join '', @group1[0..2], @group2[2,3];
    print "Match: $1\n" while $string =~ /([$group]{5})/g;