the explaination of the pattern using japhy's Yape::Regex::Explain module goes as follows:
as for the modifiers /og on the pattern take a look at perldoc perlop.The regular expression: (?-imsx:/(ATG)(...)*?(?=TAA|TAG|TGA)/og) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- ATG 'ATG' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ( group and capture to \2 (0 or more times (matching the least amount possible)): ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- )*? end of \2 (NOTE: because you're using a quantifier on this capture, only the LAST repetition of the captured pattern will be stored in \2) ---------------------------------------------------------------------- (?= look ahead to see if there is: ---------------------------------------------------------------------- TAA 'TAA' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- TAG 'TAG' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- TGA 'TGA' ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- /og '/og' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
Anyhow, hope this helps.
-enlil
In reply to Re: explanation of code pls
by Enlil
in thread explanation of code pls
by imlou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |