in reply to Regular expressions
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular expressions
by lairel (Novice) on Oct 27, 2015 at 16:38 UTC | |
by stevieb (Canon) on Oct 27, 2015 at 17:02 UTC |