Regular expressions aren't the best here. Can you try my "develop" branch? I've reduced the use of re's and added a simple state based parser for the header that works in about the same amount of time.
neat! indeed that the best way to do it. I'm writing a port of your lib in php for MISP (perform some validations on rules format). I'll switch to states/loops as well
problem
From suricata documentation, source-and-destination can be a list containing spaces in rules
solution
create regexp to match either single host or list of hosts
attempt