我已将此正则表达式的数字分组后跟一个字母:
(\d*)(\D)
当数字存在时,结果为:
[12,letter]
如果没有数字,结果是:
["",letter]
我怎么能放一些东西而不是一个空字符串? 像这样:
(\d*|put "1")(\D)
Regex能做类似的事吗?
答案 0 :(得分:0)
您可以编写自己的匹配功能。
// Download the Node helper library from twilio.com/docs/node/install
// These are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);
client.lookups.v1
.phoneNumbers('+16502530000')
.fetch({type: 'caller-name'})
.then((number) => console.log(number.carrier.type, number.carrier.name));