should we check if the `indexOrPattern` is not empty?