Should match options greedily

Changed
/(-[\w-]+?)\s*/gm 
to 
/(-[\w-]+)\s*/gm