const f = /p=(\d+)/
let text = "http://127.0.0.1/?p=200"
let match = text.match(f)
console.log(match)
if(match) {
console.log('number =',match[1])
}
输出:
[
'p=200',
'200',
index: 18,
input: 'http://127.0.0.1/?p=200',
groups: undefined
]
number = 200