Use \z instead of $ in regexp