My hint would be, find the last comma and only keep the text up to that comma.
But what if I'm typing a name and I type seap instead of sean, I hit backspace and get annoyed because I have to type it all in again, you should be careful when changing default behaviour of things, especially when people are used to these.
Ok, so here it is. I have the following text in my text box:
Sudipto Shekhar (ID2345), Jerrki (ID9301), Sam Pablo(ID1002)
I want these data to be saved in the database. Now, as the data in the textbox is fetched from the database, the user is not supposed to delete any details from the one that is present in the textbox. What I mean is I cannot change Sudipto Shekhar (ID2345) to Sudipto Shekhar (ID2346). And so, if the user tries to change anything from the text, I want to delete the whole text. For example:
Sudipto Shekhar (ID2345), Jerrki (ID9301), Sam Pablo(ID1002). If the user tries to change Sudipto Shekhar (ID2345) to Sudipto Shekhar (ID2346) and hit a backspace or delete button, I want to delete entire Sudipto Shekhar (ID2345), but just that, and want to retain rest of the text in the text box:
Jerrki (ID9301), Sam Pablo(ID1002)
A better example would be how the outlook To: textbox.
I hope I am clear now. Please let me know if I am still not clear.
In my opinion I think you have gone the wrong way about this, there are a few ways that people can get around this that it makes it almost a pointless exercise to try.
Lastly what is to stop me simply clicking in the middle of the ID and changing it, e.g. change Sam Pablo(ID1002) to Sam Pablo(ID109902).
I have a feeling that to do something like outlook it will be a bit more complicated.
Even gmail doesn't do anything like that, however if you look at hotmail, that would be exactly what you want to do.