正则表达式 - 匹配除其他 numbers/letters 以外的任何字符之间的数字

Regex - match a number in-between any character except other numbers/letters

我正在努力寻找正则表达式...

所以我有一个产品 ID 9984

我正在尝试创建一个正则表达式 (Javascript)。

以下示例应该匹配:

9984
"9984"
'9984'
 9984    //i.e. spaces are OK

以下示例 不应 匹配(即 9984 两边有数字或字母 [a-zA-Z0-9]):

a9984
9984x
z9984B
199841
299842
99843
499844
Q9984c
etc.

我正在尝试正则表达式 /[^0-9]?9984?[^0-9]+/ 在:

https://regex101.com/r/qX6vE1/1

但我无法让它工作

\b9984\b

尝试 this.This 应该 work.See 演示。

https://www.regex101.com/r/fG5pZ8/17

There are three different positions that qualify as word boundaries:

    Before the first character in the string, if the first character is a word character.
    After the last character in the string, if the last character is a word character.
    Between two characters in the string, where one is a word character and the other is not a word character.