The regex building logic is independently useful and will likely start
to be used in other places. This commits splits it out from the ostestr
cli and makes it an independent module that just contains the pieces
necessary for building a selection regex.
Change-Id: Ic8494d0f54357fdafd650b40219e6ad7fd5a65ad