gpt4 book ai didi

javascript - 匹配空格分隔的固定字符组

转载 作者:行者123 更新时间:2023-12-03 11:48:23 24 4
gpt4 key购买 nike

例如,我需要匹配3组字符,每个字符以空格分隔,在此文本上:

This is also true for humans, who can (...) hear only a limited range [12^] of sounds as well. Dogs, dolphins and other creatures can hear different frequencies than we do, for example. There is some scientific evidence our brains are receiving a much wider range of frequencies than we are able to perceive. Michael Weliky from the University of Rochester conducted a study which led him to conclude that perhaps as much as 80% of the frequencies we receive are locked in our heads, unable to be perceived.

我发现这个语法给了我我想要的结果:
[^].+?(?=).+?(?=).+?(?=)

但我想知道它是否可以改进,看起来它看起来很多余。

我的RegEx101

最佳答案

您可以删除中间的两个前瞻并仅替换为空格。

[^].+? .+? .+?(?= ) example

除此之外,您可能无法进行匹配。

关于javascript - 匹配空格分隔的固定字符组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25949017/

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