You're pretty close. I think the problem is that you're being 'greedy' in the regex. I've added a ? after the .* to make it non-greedy. The ?: tells the inner parens to not capture. The outer parens will do this for us.
This example captures everything including the delimiters:
m/(ATG.*?(?:TAG|TAA|TGA))/g
This one will capture only inside the delimiters:
m/ATG(.*?)(?:TAG|TAA|TGA)/g
In reply to Re: Regular expressions
by stevieb
in thread Regular expressions
by lairel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |