How could I split up some text so that I only get a part of it?

Earlier I asked if I could replace [N] with someones name, for a script I'm distributing, and this is linked in, as I also want to add functionality for their ingame IDs. Only problem is, that the echo channel always says their ID's like this (ID:36) or [36]. I only want the 36 so I can add that to the copy and paste script I discussed in my last thread

Last thread(if you want to know what i'm trying to do exactly): https://forums.mirc.com/ubbthreads.php/topics/240725/Converting_text#Post240725