MySQL full text search equivalents to Google search: Difference between revisions
Tags: Mobile edit Mobile web edit |
Tag: wikieditor |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 184: | Line 184: | ||
</tr> | </tr> | ||
</table> | </table> | ||
1. English Keyword Version - "AI agent/agents" | |||
Create a Google Sheets formula that suggests a title by extracting text leading up to the "AI agent" mention. {{exclaim}} case-insensitive!: | |||
<pre> | |||
=IF( | |||
REGEXMATCH(A2, "(?i)\bAI\s*agents?\b"), | |||
REGEXEXTRACT( | |||
A2, | |||
".{0,10}(?i)\bAI\s*agents?\b.{0,10}" | |||
)&" ...", | |||
"" | |||
) | |||
</pre> | |||
Here's a breakdown of the Google Sheets formula that extracts excerpts containing "AI agent" or "AI agents": | |||
The formula has two main parts: | |||
# REGEXMATCH to check if the phrase exists | |||
# REGEXEXTRACT to get the surrounding context if found | |||
Pattern explanation: | |||
* `(?i)` makes the match case-insensitive | |||
* `\b` ensures word boundaries | |||
* `\s*` allows any number of spaces | |||
* `s?` makes the 's' optional (matches both singular and plural) | |||
The formula will: | |||
* Search for "AI agent" or "AI agents" in cell A2 | |||
* If found, extract up to 10 characters before and after the match | |||
* Add "..." to indicate truncation | |||
* Return empty string if no match | |||
Will match: | |||
* "AI agent" | |||
* "AI agents" | |||
* "ai Agent" | |||
* "Ai AGENTS" | |||
* "The AI agent is" | |||
* "Multiple AI agents are" | |||
Won't match: | |||
* "AIagent" | |||
* "AImagent" | |||
* "AI agentify" | |||
2. Chinese Keyword Version - "AI代理" or "AI 代理" | |||
Create a Google Sheets formula that suggests a title by extracting text containing "AI代理". {{exclaim}} case-insensitive!: | |||
<pre> | |||
=IF( | |||
REGEXMATCH(A2, "(?i)\bAI\s*代理"), | |||
REGEXEXTRACT( | |||
A2, | |||
".{0,10}(?i)\bAI\s*代理.{0,10}" | |||
)&" ...", | |||
"" | |||
) | |||
</pre> | |||
Here's a breakdown of the Google Sheets formula that extracts excerpts containing "AI代理": | |||
The formula has two main parts: | |||
# REGEXMATCH to check if the phrase exists | |||
# REGEXEXTRACT to get the surrounding context if found | |||
Pattern explanation: | |||
* `(?i)` makes the match case-insensitive (affects the "AI" part) | |||
* `\b` ensures word boundary before "AI" | |||
* `\s*` allows any number of spaces between "AI" and "代理" | |||
The formula will: | |||
* Search for "AI代理" or "AI 代理" in cell A2 | |||
* If found, extract up to 10 characters before and after the match | |||
* Add "..." to indicate truncation | |||
* Return empty string if no match | |||
Will match: | |||
* "AI代理" | |||
* "AI 代理" | |||
* "ai代理" | |||
* "ai 代理" | |||
* "This is AI代理 system" | |||
* "About AI 代理 research" | |||
Won't match: | |||
* "AI代理人" (AI agent person) | |||
* "智能代理" (Intelligent agent) | |||
* "代理AI" (Agent AI) | |||
=== Microsoft Spreadsheet approach === | === Microsoft Spreadsheet approach === | ||
| Line 222: | Line 310: | ||
* [http://www.w3resource.com/mysql/string-functions/mysql-position-function.php MySQL POSITION() function - w3resource] / [http://www.w3resource.com/mysql/string-functions/mysql-length-function.php MySQL LENGTH() function - w3resource] where the keywords located. | * [http://www.w3resource.com/mysql/string-functions/mysql-position-function.php MySQL POSITION() function - w3resource] / [http://www.w3resource.com/mysql/string-functions/mysql-length-function.php MySQL LENGTH() function - w3resource] where the keywords located. | ||
== | == Related articles == | ||
to explore strange new worlds / related articles: | to explore strange new worlds / related articles: | ||
* [http://dev.mysql.com/doc/refman/5.1/en/regexp.html MySQL :: MySQL 5.1 Reference Manual :: 12.5.2 Regular Expressions] | * [http://dev.mysql.com/doc/refman/5.1/en/regexp.html MySQL :: MySQL 5.1 Reference Manual :: 12.5.2 Regular Expressions] | ||
| Line 242: | Line 330: | ||
* does not equal ____ | * does not equal ____ | ||
== References == | |||
<references/> | <references/> | ||
| Line 259: | Line 342: | ||
[[Category:Search]] | [[Category:Search]] | ||
[[Category:Data Science]] | [[Category:Data Science]] | ||
[[Category: Revised with LLMs]] | |||