Ok. If this question is still remains relevant and you were unable to complete the code yourself, you can create a detailed list of all the required input data variants with an address mask and indicate what the return result of the response should be for each command separately/individually, to better understanding of how this can be implemented in code.
For example:
/addnick nick* ➔ Return: nick*!*@*/addnick nick*! ➔ Return: nick*!*@*/addnick nick! ➔ Return: nick!*@*/addnick nick!* ➔ Return: nick!*@*/addnick *@127.0.1.2 ➔ Return: *!*@127.0.1.2/addnick *!*@127.0. ➔ Return: *!*@127.0.*/addnick @127.0 ➔ Return: *!*@127.0*/addnick @127. ➔ Return: *!*@127.*/addnick @127.0.1.2 ➔ Return: *!*@127.0.1.2- ...
Note: To ensure that host/IP addresses are correctly identified, I would recommend always adding/using/specifying before them the "
@" symbol.