REGEX选择超过4个字符的单词,但仅一个实例,如果重复
我正在尝试使用GREP样式在Indesign中格式化文本。 目的是在段落中选择比4个字母更长的单词,但是如果在段落中重复该单词,则不应选择该单词的第一例实例。 这是示例文字:
“主的右手被抬高;主的右手做了强大的事情!” 解决方案应该让
- 右手抬起
我在第一部分所做的
[[:word:]]{4,}
强大的事情,但不知道如何处理这些重复项。
I am trying to format text in InDesign using GREP Style.
The goal is to select words longer then 4 letters in a paragraph but if the word has been duplicated in a paragraph it should not select more then first instance of this word.
This is sample text:
"The Lord's right hand is lifted high; the Lord's right hand has done mighty things!"
The solution should give
- Lord right hand lifted high done mighty things
i have done the first part
[[:word:]]{4,}
but don't have a clue how to deal with those duplicates.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是订单要求吗?如果不是,那么稍后文本中的单词比4个字符不跟随同一单词的单词呢?请参阅:
https://regex101.com/r/r/ug4dlz/1
结果右手做了很多事情
要更全面,包括单词中断(即“人”和“人格”作为两个单独的单词):
Is order a requirement? If not, how about words longer than 4 characters not followed by that same word later in the text? See:
https://regex101.com/r/Ug4dLZ/1
Result: lifted high Lord right hand done many things
To be more comprehensive, include word breaks (i.e. count "Person" and "Personhood" as 2 separate words):