Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
const matches = s.match(/\b\d{3}\b/);
const x = matches ? matches[0] : '';
Matcher m = compile("\\b\\d{3}\\b").matcher(s);
String x = m.find() ? m.group() : "";
my ($x) = $s =~ /\b(\d{3})\b/;