[core] fixing broken build

PR 2820 uses a regular expression that is not supported in ruby 1.8.7. This reverts that PR.