What happens if you just change `/^(.*_)(.+)\0\1(.+)/` to `/^(.*[._])(.+)\0\1(.+)/`?