There's a similar method in puppet, which was creating a local regexp like this, and Daniel found it was better to create a constant regex and use that. Might want to do the same here, especially as the constant could live in different impls.