感谢那几位大佬指点,给他们发红包感谢了。(其实就几毛钱,但是我QQ也就剩下这么多...... )

方法1

str = '[CQ:at,qq=1052757154,text=@筱可儿]';
qq = str.match(/qq=(\d+)/);
console.log(qq)

输出:

[
  'qq=1052757154',
  '1052757154',
  index: 7,
  input: '[CQ:at,qq=1052757154,text=@筱可儿]',
  groups: undefined
]

QQUID=qq[1]

方法2

str = '[CQ:at,qq=1052757154,text=@筱可儿]';
qq=str.match(/(?<=qq=)\d+|(?<=text=@).+(?=\])|(?<=\]).*/g);
console.log(qq)

输出:

[ '1052757154', '筱可儿', '' ]

QQUID=qq[0],nickname=qq[1]

标签: none

添加新评论