我只希望Regex仅搜索拼写错误-如何排除正确的拼写? [英] I only want Regex to only search spelling mistakes - how to exclude correct spellings?
问题描述
我的目标是找出拼写错误的单词/短语.
My goal is to identify a words/phrases which has been misspelt.
我想从搜索中排除正确的实例.我想识别所有拼写错误的单词是"Whats'App"(带或不带撇号).
I want to exclude correct instances from my search. The word I want to identify all misspellings of is "Whats'App" (with and without the apostrophe).
我想确定字母换成数字的实例.
I want to identify instances when a letter has been swapped out for a number.
现在是我的正则表达式,它适用于所有实例,包括正确的拼写. 我希望代码排除以下两个单词; whatsapp和whats'app.
Here is my regex now which works well for all instances including correct spellings. I want the code to exclude the following two words; whatsapp and whats'app.
我正在Elastic中运行它.
I am running this in Elastic.
wh[a4]t[s5]’?[a4]pp
推荐答案
谢谢大家的帮助.该问题的解决方案是使用@&~(abc.+)
排除正确的实例.我在 eslatics网站上找到了答案.
Thank you all for your help. The solution to this question was to exclude the correct instances by using @&~(abc.+)
. I discovered the answer on eslatics site.
这是现在可以使用的查询;
Here is the query that now works;
wh[a4]t[s5]’?[a4]p+@&~(whats’?ap+)
不幸的是,我得到了一些意想不到的结果,其中未发现某些拼写错误.它必须与此查询中的另一个问题相关,我将作为一个单独的问题发布.
Unfortunately, I have some unexpected results where some misspellings are not identified. It must relate to a different problem in this query that I will post as a separate question.
谢谢, 肖恩
这篇关于我只希望Regex仅搜索拼写错误-如何排除正确的拼写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!