Skip to main content

match-quasar

ai-research-agent / match/match-quasar

Match

matchQUASAR()

function matchQUASAR(document, query): boolean

QUASAR: Quotes-Unifying Alphanumeric Search-All RegExp

Search document for all words of query ignoring casing but "words in quotes" as necessarily together like users expect in web search engines. Single line function that can be used anywhere, such as UI inputs to filter a data list.

Parameters

ParameterTypeDescription

document

string

query

string

Returns

boolean

true if doc has all words and "phrases in quotes"

Example

var isFound = matchQUASAR(`Ask not what your country can do for you, 
ask what you can do for your country. is nothing to fear but fear itself.`,
` "Ask not" "but fear itself" nothing`) // returns true

Author

ai-research-agent (2024)