So users are the ones giving this input. You seem to have excluded a lot of relevant information from this discussion. I really don't care about a difference between viewers and mods, the only thing that matters is the input to this alias and where it originates (you or elsewhere). To confuse things even more you're referring to three different things all as commands.
This is what I've gotten from your explanation:
1. A user types !profile nick
2. Some other person crafts a user friendly message
3. This message is sent to you, evaluated, and sent to the channel
That doesn't provide a use for @target@ though.
But here's a new thought I've had based on past experience with twitch requests and not at all from what you've explained:
1. A mod can craft a new "command" which consists of a "command" part and "response" part.
2. You expose something like !addcom to privileged users and store these in an ini file or hash table.
3. You have a catch-all text event which checks if a user has said a "command" present in your data structure.
4. The corresponding response is evaluated by the alias we've been discussing and sent to the channel. This does allow a stored @target@[1] to refer to the original text of the !profile command.
My original request contained the necessary information and your regex and sample use of it provided what I needed (thus the thanks in a previous post).
To the people in chat, typing something like "!profile someUserName" is using a command because "!profile" is thought of as a command. The "someUserName" is considered to be a value. The grabbing it as input and using it as a substitution in a predefined string is part of the scripting. So...
1. Predefined %variable contains the crafted response with the replaceable @values@ in it.
2. Someone uses a !command (ex !profile someUserName)
3. Script processes it and responds to the chat, all fully automated.
The @value@ references call upon commands that process it into what it needs to be. @profile@[someUserName] for example returns a link to the specified persons Twitch profile. @user@ gets replaced with $nick (person using the command being processed), @target@[1] ... @target@[99] calls on that token #, etc. It makes it so certain dynamic values can be processed without introducing security issues (ie, not evaluating $'s and such).
The reason I refer to them as @commands@ is because they are, in a manner of speaking, commands. From the user perspective, it's not, but from a scripting perspective, it is, because an alias (command) is called upon to handle it. The 'catch all' is actually for a few select things where the exact same process would be followed to obtained one of many values (which would all be grabbed at the same time no matter what). So instead of having a bunch of aliases to do the exact same thing, have the 'catch all' do it and simply return the desired value from the obtained data.
Also, the IRC on Twitch filters out bold/underline/etc. Only real use for it is client side if you want to have something stand out. Once it's sent to the chat server, it's filtered and not sent out to the other chatters.