added single/global replacement and case insensitivity