reimplement fallback resource dir logic without std::regex
reimplement fallback resource dir logic without std::regex

The std::regex_replace() logic that worked on Ubuntu 15.10
and 16.04 throws a regex exception on Ubuntu 14.04.  Rather
than fight std::regex C++11 features in a system 3 years
past that, reimplement the string manipulation logic without it.

apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb