Return -1 if onlyFirst is true in case no match