Programmer Guide/Command Reference/QUERY: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
The <code>QUERY</code> command, although similar to the <code>[[Programmer Guide/Command Reference/FIND|FIND]]</code> command, offers the programmer more choice in how to search. | The <code>QUERY</code> command, although similar to the <code>[[Programmer Guide/Command Reference/FIND|FIND]]</code> command, offers the programmer more choice in how to search. It returns the zero-based index of the first entry matching the search criteria, or an empty string if the search criteria were not matched. | ||
QUERY [ /i ] [ /t ] [ /m=<var>matchtype</var> ] [[Programmer_Guide/Command_Reference_Options/-|/-]] <var>table</var> <var>startentry</var> <var>field</var> <var>querystring</var> | #pos := QUERY [ /i ] [ /t ] [ /m=<var>matchtype</var> ] [[Programmer_Guide/Command_Reference_Options/-|/-]] <var>table</var> <var>startentry</var> <var>field</var> <var>querystring</var> | ||
QUERY /m=find <var>table</var> <var>startentry</var> <var>cepr</var> [ <var>copr</var> <var>cexpr</var> ... ] [ /t ] // works like <code>[[Programmer_Guide/Shell_Items/Table/SET_TABLE#FINDEXPR|SET table FIND]]</code> | #pos := QUERY /m=find <var>table</var> <var>startentry</var> <var>cepr</var> [ <var>copr</var> <var>cexpr</var> ... ] [ /t ] // works like <code>[[Programmer_Guide/Shell_Items/Table/SET_TABLE#FINDEXPR|SET table FIND]]</code> | ||
;<var>matchtype</var>: one of the keywords <code>regular</code>, <code>wildcard</code>, <code>substring</code>, <code>full</code>, and <code>find</code>. | ;<var>matchtype</var>: one of the keywords <code>regular</code>, <code>wildcard</code>, <code>substring</code>, <code>full</code>, and <code>find</code>. |
Latest revision as of 11:47, 16 May 2018
The QUERY
command, although similar to the FIND
command, offers the programmer more choice in how to search. It returns the zero-based index of the first entry matching the search criteria, or an empty string if the search criteria were not matched.
#pos := QUERY [ /i ] [ /t ] [ /m=matchtype ] /- table startentry field querystring
#pos := QUERY /m=find table startentry cepr [ copr cexpr ... ] [ /t ] // works like SET table FIND
- matchtype
- one of the keywords
regular
,wildcard
,substring
,full
, andfind
.
- table
- the table to search.
- startentry
- the zero-based index of the entry at with which to start the search.
- field
- the table field to search.
- querystring
- the string to search for.
- cexpr, copr cexpr
- see
SET table FIND
. /i
- The search will be case insensitive (by default, it is case sensitive).
/t
- only tagged table entries will be considered.
/m=regular
- querystring will be considered a POSIX regular expression.
/m=wildcard
- querystring will be considered an STx wildcard expression (just like
FIND
). /m=substring
- All characters in querystring will be considered autonomous, i.e. naming themselves. The
FIND
command will find the first entry of which querystring is a substring. /m=full
- All characters in querystring will be considered autonomous, i.e. naming themselves. The
FIND
command will find the first entry whose content is exactly identical to querystring (with the possible exception of case). /-
- You should always use the /- "non-option" option before the first argument in order not to cause arguments to be mistaken for options.