Minimum span search for text