Simplify substring matching operations