Implementing elementary routing using regular expressions