>perl -wMstrict -le "my $class = qr{ [actg] }xms; ;; for my $str (qw(ac-t-c-t-g a----c-tg-ggg --a-c-t-g-a-a-a--)) { $str =~ m{ \A ((?: -* $class){4}) }xms; print qq{from '$str' -> ($1)}; } " from 'ac-t-c-t-g' -> (ac-t-c) from 'a----c-tg-ggg' -> (a----c-tg) from '--a-c-t-g-a-a-a--' -> (--a-c-t-g)
In reply to Re: Perl match
by AnomalousMonk
in thread Perl match
by nicholaspr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |