All while making sure that "Bob" always gets assigned to the same wildcard. Using regexpes. In only one trigger.
So far I came up with "((.*?) shoves you|You shove (.*?))\."
But somehow it feeds the whole line ("You shove Bob") in the first wildcard, and "Bob" in either the 2nd or the 3rd wildcard. (the other one being an empty string)
That is because parentheses denote captured groups, as in '(' + group + ')'. So since the outer group is the first one it encounters, it will catch it.
There's a simple way to negate this behaviour, and that is to specify it not to capture, like this:
(?:(.*?) shoves you|You shove (.*?))\.
That could be simplified if you knew each name was only one word:
(?:(\w+) shoves you|You shove (\w+))\.
And if you preferred, you could get rid of the entire non-capturing group all together like this:
(\w+) shoves? (\w+)\.
The ? means 0 or 1 character of the group before it - in this case, the letter s. By checking the second captured group and seeing if it equals 'you', you are able to tell what case of the trigger it is (if you needed it). Additionally, I added a ^ (=beginning of line) in front and a $ (=end of line) at the end to signify that this is an entire line of output and not part of something like "Poo smells. Poo shoves the kingdom. Pee conquers all!" which your current trigger would fire on.
Edit: Oops, sleepiness. Misread it a bit, but you could of course perform the 'you' check on the first wildcard too, if you needed. But probably, the best solution would remain to be: