Implement flexible target specification

See commit message.
While a regex certainly makes sense here, can we avoid pulling in the entire regex crate just for this one use case?