in reply to Regex to match range of characters broken by dashes
... where it effectively ignores dashes....
Preprocess the sequence to get ride of the dashes:
$seq =~ s/-//g; # remove any dashes, first $seq =~ s/[ATGC]{2}/$&$tag/; $seq =~ s/$tag[ATGC]{4}/$&$tag/;
Update: As pointed out, in some circumstances, the desired output can have dashes.
So, add a look-ahead so that only single dashes are removed:
$seq =~ s/-(?!-)//g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to match range of characters broken by dashes
by Anonymous Monk on Jul 15, 2016 at 22:21 UTC |