gpt4 book ai didi

JavaScript(正则表达式): excluding matches from output

转载 作者:数据小太阳 更新时间:2023-10-29 05:55:48 24 4
gpt4 key购买 nike

我有这个文本:nisi non text600 elit 其中 600 是动态添加的。我怎样才能得到它?

var str = ('nisi non text600 elit').match(/text\d+/);
alert(str);

这会提醒 text600,我如何才能只提醒 600 而无需额外替换单词 text(如果可能的话)?

感谢任何帮助,谢谢!

最佳答案

var str = ('nisi non text600 elit').match(/text(\d+)/);
alert(str[1]);

关于JavaScript(正则表达式): excluding matches from output,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10701367/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com