Regex to ignore digits before and after a number but accept the number in standalone? [duplicate]

Can someone help me with a regular expression? How can I write one in JS that will accept:

“42”
“42 is my favorite number”
“I have 42 cats”
“I really like 42”

But reject
“12342”
“423”
“14211”
“167889994442113233”
Etc.

I tried D*42D* but no dice.. it’s been keeping me up! Any tips? It’s been a few years since I covered regexs