generate_packets.py: extract regex into constants
Part of #43927. Extract all regular expressions into constants, either on a module level, or (when appropriate) as class members.
Depends on #44571, #44572 and #44573
Part of #43927. Extract all regular expressions into constants, either on a module level, or (when appropriate) as class members.