Regex in DRONE:
When performing keyword searches in DRONE, you can leverage regular expressions (POSIX regex) for more flexible and advanced search capabilities. Here’s how it works:
1. Regex Search Format:
Section titled “1. Regex Search Format:”To use regex, your keyword must be enclosed between / / slashes. For example:
/\d+/– This will search for one or more digits./[a-z]+/i– This will search for one or more lowercase letters and is case-insensitive (thanks to theiflag).
You can also include optional flags at the end of the regex to modify its behavior:
- g: Global (search all occurrences).
- m: Multiline (match across multiple lines).
- i: Case-insensitive (ignore letter case).
- s: Dot matches newline (dot
.will match any character, including newlines).
Example:
/[A-Z]+\d+/i – This will match sequences like “ABC123” or “abc123” regardless of case.
2. Wildcard Search:
Section titled “2. Wildcard Search:”If your search contains wildcard patterns like *? (indicating lazy quantifiers), it will be treated as a wildcard search instead of a regex search.
- For example,
abc*?will match “abc”, “abcd”, “abcxyz”, etc.
3. String Contains Search:
Section titled “3. String Contains Search:”If your input doesn’t match the regex format and doesn’t contain wildcard symbols, DRONE will perform a case-insensitive “string contains” search.
- For example, searching for
examplewill return results containing “example”, “Example”, or “EXAMPLE”.