Using the ab initio pseudopotential density functional method, we investigate the functionalization of halogen molecules into graphene-based nanostructures with zigzag and armchair edges. We find that halogen molecules adsorb through chemisorption on the zigzag edge carbon atoms with a binding energy of ~1-5 eV and their adsorption on a perfect zigzag edge is preferred, in sharp contrast to physisorption on the armchair edge and elsewhere where they adsorb with a binding energy of ~0.07 eV. We suggest that our findings would be utilized for an approach to the separation of zigzag graphene nanoribbons with regular edges with the change of the solubility of the functionalized nanoribbons.