The table summarizes the string operators available in APL. For set membership operators (Documentation Index
Fetch the complete documentation index at: https://axiom.co/docs/llms.txt
Use this file to discover all available pages before exploring further.
in, !in, in~, !in~), see Set membership operators.
| Operator | Description | Case sensitive | Example |
|---|---|---|---|
| == | Equals | Yes | "aBc" == "aBc" |
| != | Not equals | Yes | "abc" != "ABC" |
| =~ | Equals | No | "abc" =~ "ABC" |
| !~ | Not equals | No | "aBc" !~ "xyz" |
| contains | RHS occurs as a subsequence of LHS | No | "parentSpanId" contains "Span" |
| !contains | RHS doesn’t occur in LHS | No | "parentSpanId" !contains "abc" |
| contains_cs | RHS occurs as a subsequence of LHS | Yes | "parentSpanId" contains_cs "Id" |
| !contains_cs | RHS doesn’t occur in LHS | Yes | "parentSpanId" !contains_cs "Id" |
| startswith | RHS is an initial subsequence of LHS | No | "parentSpanId" startswith "parent" |
| !startswith | RHS isn’t an initial subsequence of LHS | No | "parentSpanId" !startswith "Id" |
| startswith_cs | RHS is an initial subsequence of LHS | Yes | "parentSpanId" startswith_cs "parent" |
| !startswith_cs | RHS isn’t an initial subsequence of LHS | Yes | "parentSpanId" !startswith_cs "parent" |
| endswith | RHS is a closing subsequence of LHS | No | "parentSpanId" endswith "Id" |
| !endswith | RHS isn’t a closing subsequence of LHS | No | "parentSpanId" !endswith "Span" |
| endswith_cs | RHS is a closing subsequence of LHS | Yes | "parentSpanId" endswith_cs "Id" |
| !endswith_cs | RHS isn’t a closing subsequence of LHS | Yes | "parentSpanId" !endswith_cs "Span" |
| matches regex | LHS contains a match for RHS | Yes | "parentSpanId" matches regex "g.*r" |
| !matches regex | LHS doesn’t contain a match for RHS | Yes | "parentSpanId" !matches regex "g.*r" |
| has | RHS is a whole term in LHS | No | "North America" has "america" |
| !has | RHS isn’t a whole term in LHS | No | "North America" !has "america" |
| has_cs | RHS is a whole term in LHS | Yes | "North America" has_cs "America" |
| !has_cs | RHS isn’t a whole term in LHS | Yes | "North America" !has_cs "America" |
| has_any | RHS has any whole term in LHS | No | "North America" has_any ("America", "Europe") |
| has_any_cs | RHS has any whole term in LHS | Yes | "North America" has_any_cs ("America", "Europe") |
| hasprefix | LHS string starts with the RHS string | No | "Admin_User" hasprefix "Admin" |
| !hasprefix | LHS string doesn’t start with the RHS string | No | "Admin_User" !hasprefix "Admin" |
| hasprefix_cs | LHS string starts with the RHS string | Yes | "DOCS_file" hasprefix_cs "DOCS" |
| !hasprefix_cs | LHS string doesn’t start with the RHS string | Yes | "DOCS_file" !hasprefix_cs "DOCS" |
| hassuffix | LHS string ends with the RHS string | No | "documentation.docx" hassuffix ".docx" |
| !hassuffix | LHS string doesn’t end with the RHS string | No | "documentation.docx" !hassuffix ".docx" |
| hassuffix_cs | LHS string ends with the RHS string | Yes | "Document.HTML" hassuffix_cs ".HTML" |
| !hassuffix_cs | LHS string doesn’t end with the RHS string | Yes | "Document.HTML" !hassuffix_cs ".HTML" |
Case-sensitivity
Operators with_cs suffix are case-sensitive.
When two operators do the same task, use the case-sensitive one for better performance.
For example:
- Instead of
=~, use== - Instead of
has_any, usehas_any_cs - Instead of
contains, usecontains_cs
Best practices
- Use case-sensitive operators when you know the case to improve performance.
- Avoid complex regular expressions for basic matching tasks. Use basic string operators instead.
- When matching against a set of values, ensure the set is as small as possible to improve performance.
- For matching substrings, use prefix or suffix matching instead of general substring matching for better performance.
Equality and inequality operators
Operators:==!==~!~in!inin~!in~
- Use
==or!=for exact match comparisons when case sensitivity is important. - Use
=~or!~for case-insensitive comparisons or when you don’t know the exact case.
Subsequence-matching operators
Operators:contains!containscontains_cs!contains_csstartswith!startswithstartswith_cs!startswith_csendswith!endswithendswith_cs!endswith_cs
contains_cs, startswith_cs, endswith_cs) when you know the case to improve performance.
Regular-expression-matching operators
Operators:matches regex!matches regex
Term-matching operators
A term is a contiguous sequence of Unicode letters and numbers. Any other character, including spaces, hyphens, underscores, and dots, acts as a term boundary. For example,foo-bar and foo_bar each produce the terms foo and bar, so has "foo" matches both.
Operators:
has!hashas_cs!has_cshas_anyhas_any_cshasprefix!hasprefixhasprefix_cs!hasprefix_cshassuffix!hassuffixhassuffix_cs!hassuffix_cs
- Use
hasorhas_csfor term matching which can be more efficient than regular expression matching for simple term searches. - Use
has_anyorhas_any_csfor matching against multiple possible terms. - Use
has_csorhas_any_cswhen you know the case to improve performance. - Unlike the
containsoperator, which matches any substring, thehasoperator looks for exact terms, ensuring more precise results.