Don't need the trailing ' ?'. $string =~ s! ?NOT (?:".*?"\[MESH\]|\(.*?\))!!g; works fine.
In reply to Re^3: refine regex by ikegami in thread refine regex by rsiedl