var number=str.replace(/^[^ 1-9]*|\d/g,'');
Alarm (number);
Conventional description
The middle | means or, that is, as long as one of the conditions on both sides of it is met, it will be replaced by null.
The first indicates the beginning.
[1-9] means a number other than 1-9 (in [], it means none).
* indicates that the previous content can be none or one or more.
\D means non-number.
G is a global match, otherwise it is only matched (replaced) once.