Optimize case-insensitive matching