Added ability to use case-insensitive regex flags.