如何搜索术语“;AI”;使用regex

How to search for term "AI" with regex

本文关键字:AI 使用 regex 术语 何搜索 搜索      更新时间:2024-05-02

我正试图找出如何编写一个正则表达式,该表达式返回单词"AI"而不返回包含"AI"的单词。

我的猜测是,只有在"ai"左侧有一个字符的空白和"ai"右侧有一个空格的情况下,我才需要使用返回"ai"的运算符。

但允许在两端使用标点符号。

目标是返回如下搜索结果:

"AI, the future of computing"
or
"Has AI finally arrived?"
as opposed to
"He said what?" (Notice ai is within the word "said".)

使用表示单词边界的'b。例如'bAI'b

您也可以将'b(AI)'b用于此实例。