But this also accepts 'sanchit@-algo.-csail.-mit.edu' & 'sanchit@algo.-csail.-mit.edu',etc.
I found some errors in my file - I had written 'name' instead of 'id' & had missed 3 ';'s.
Now, I have fixed it.
It works for most real life examples(that I tested now; please tell me in case I am wrong). So I'll use it instead of those long loops.