please use the [ code] in the # icon instead of quote, as it makes reading the code easier.

Hopefully you plan to be a little more precise with your wildcards. You're checking if the string contains uid or sid, but that matches someone with identd set to guido or sidney. Assuming $5 contains nick!identd@host you should search for a regex pattern like:

Code:
//var %5 test!~uid123test | echo -a $regex(%5,!~?uid\d+)


this only matches the uid if followed by at least 1 number, and preceded by either ! or ~!
If it's just the identd@host you can anchor to the beginning of the string with by replacing the ! with ^