in reply to Modification of read only values.

In addition, the inverted character set  [^TAG|TAA|TGA] in the OP regex does not do what I think you think it does. The | (pipe) character has no special meaning in a character set, nor does repetition of a character have significance. The set above is equivalent to the  [^|TAG] set.

My guess about what you originally intended is something along the lines of "not followed by any of the sub-sequences TAG, TAA or TGA". This can be achieved by the negative look-ahead assertion
    (?! TAG | TAA | TGA)
(assuming use of the /x regex modifier).

However, the original expression was  [^TAG|TAA|TGA]? (or its equivalent [^|TAG]?) — note the ? quantifier — meaning "Some character other than  | T A G must be present — or not. Whatever." The ? quantifier makes the whole thing optional either in its character set form or as a negative look-ahead.

On The Other Hand, the OP m// regex used the /g modifier, so the intent may have been something like "step over any three bases other than a TAG, TAA or TGA sub-sequence, if present", which could be achieved by
    (?: (?! TAG | TAA | TGA) ...)?
(again, with the /x modifier), but this is reading a lot into Ekolet's OP.

Update: Furthermore, the  \w+[^ATG]? sub-expression is suspect. I don't understand the intention of this one either if one assumes matching against a string consisting only of A T C G characters or, more generally, only \w characters; in either case, the  \w+ will 'consume' anything that might be matched by the optional  [^ATG]? which is thus rendered effectless.