in reply to Re: Simple regex question. Grouping with a negative lookahead assertion.
in thread Simple regex question. Grouping with a negative lookahead assertion.

I am trying to capture the very short string after the 'atg' and before (not including) either 'taa', 'tag', or 'tga'.

The very short string (three nucleotides) are those after the first 'atg' and before any of the three stop codons (in DNA form, i.e., before transcription has occurred)...in other words 'gga' since the 'taa' which immediately follows should (ideally) prevent further matching.

For example:

$dna = q/attatcgatgaaattagggctaatctcgcggggcctat/; ^-^ ^-^ match match and exit


The characters (nucleotides) between the markers (and only these) should be captured and accessible in $1.
  • Comment on Re^2: Simple regex question. Grouping with a negative lookahead assertion.
  • Download Code