now matches the whole document or the selections