Text::Q...eSimple(3)
okay so welcome to the Text::Q...eSimple(3) page β yes bestie, that's the manual name β and it's coming at you from User Contributed Perl Documentation. The main character here is Text::Query::ParseSimple, and it parses AltaVista simple query syntax. Let's get into it π
β¨ NAME β¨
Text::Query::ParseSimple β parse AltaVista simple query syntax. That's the vibe, periodt.
π οΈ SYNOPSIS π οΈ
Here's the exact invocation, no cap:
use Text::Query;
my $q=new Text::Query('hello and world',
-parse => 'Text::Query::ParseSimple',
-solve => 'Text::Query::SolveSimpleString',
-build => 'Text::Query::BuildSimpleString');
π DESCRIPTION π
This module provides an object that parses a string containing a Boolean query expression similar to an AltaVista "simple query". Elements of the query expression may be assigned weights. It's giving parser energy, fr fr.
Its base class is Text::Query::Parse. That's the parent class, iykyk.
Query expressions are compiled into an internal form when a new object is created or the prepare method is called; they are not recompiled on each match. So like, do the prep once and slay.
Query expressions consist of words (sequences of non-whitespace) or phrases (quoted strings) separated by whitespace. Here's the breakdown, bestie:
- Words or phrases prefixed with a
+must be present for the expression to match. - Words or phrases prefixed with a
-must be absent for the expression to match. - Words or phrases may optionally be followed by a number in parentheses. The number specifies the weight given to the word or phrase. If a weight is not given, a weight of
1is assumed.
okay but listen: no whitespace is allowed between the word or phrase and the parenthesized number. That's a hard no, bestie. π«Ά
π EXAMPLES π
Here's the whole example block, verbatim, no edits:
use Text::Query;
my $q=new Text::Query('+hello world',
-solve => 'Text::Query::SolveSimpleString',
-build => 'Text::Query::BuildSimpleString');
die "bad query expression" if not defined $q;
$count=$q->match;
...
$q->prepare('goodbye adios -"ta ta"', -litspace=>1);
#requires single space between the two ta's
if ($q->match($line, -case=>1)) {
#doesn't match "Goodbye"
...
$q->prepare('\\bintegrate\\b', -regexp=>1);
#won't match "disintegrated"
...
$q->prepare('information(2) retrieval');
#information has twice the weight of retrieval
π SEE ALSO π
π AUTHORS π
- Eric Bohlman (
ebohlman@netcom.com) - Loic Dachary (
loic@senga.org)
signing off with the footer deets, bestie: this page is from perl v5.38.2, dated 2024-07-13, and the manual name is Text::Q...eSimple(3). mwah π
π
π¦ where this page comes from
- arch rolling: perl-text-query 0.09-5 Β· GPL AND PerlArtistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms