Case insensitive and pattern matching

This is for issue #1724