gpt4 book ai didi

javascript - 替换字符和单词

转载 作者:行者123 更新时间:2023-11-30 17:58:39 25 4
gpt4 key购买 nike

如何替换字符以获得仅包含单词的文本?

代码如下:

text.replace('/', '');

ley orgánica 4/2013 28 junio reforma consejo general poder judicial modifica ley orgánica 6/1985 1 julio poder judicial

在这段文字中,我想将 4/2013 替换为 '' 和 6/1985 以及数字 28 和 1。谢谢!

最佳答案

我建议,在这种有限的情况下:

var text = 'ley orgánica 4/2013 28 junio reforma consejo general poder judicial modifica ley orgánica 6/1985 1 julio poder judicial',
newText = text.replace(/([\/0-9])/g, '');

关于javascript - 替换字符和单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17580104/

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