in reply to Regex /g and interpolated lengths
Well, that would depend entirely on your data, wouldn't it? Your regex looks for the desired string (e.g. "ctaac"), followed by exactly $len other characters. When I run that it works perfectly:
prints$allseq="ctaacjkjfggctaatlkj"; $len=3; while($allseq =~ /(ct(?:a|g)a(?:c|t))(?:.{$len})/g) {push(@array, $1);} print join("-",@array)."\n";
ctaac-ctaat
What were you expecting? Do you maybe want {0,$len}? arbitrary characters?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex /g and interpolated lengths
by Anonymous Monk on Nov 15, 2005 at 21:57 UTC | |
by tirwhan (Abbot) on Nov 15, 2005 at 22:07 UTC | |
by Anonymous Monk on Nov 15, 2005 at 22:10 UTC | |
by duff (Parson) on Nov 15, 2005 at 22:18 UTC | |
by KaiAllard (Initiate) on Nov 15, 2005 at 22:21 UTC | |
| |
by tirwhan (Abbot) on Nov 15, 2005 at 22:14 UTC | |
by tirwhan (Abbot) on Nov 15, 2005 at 22:32 UTC | |
by KaiAllard (Initiate) on Nov 15, 2005 at 22:37 UTC | |
| |
|
Re^2: Regex /g and interpolated lengths
by Anonymous Monk on Nov 15, 2005 at 22:03 UTC |