Find
Find where a text (or regular expression) first appears, starting from a position.
Command in the String toolkit · id ooa.string/find · 7 inputs (2 required), 8 outputs
Inputs
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Text | String | Yes | Text to search in. | |
| Find | String | Yes | Text or regular expression to look for. | |
| Find is a regular expression | Boolean | No | false | Treat 'find' as a regular expression. |
| Start | Number | No | 0 | Zero-based position to start searching from. |
| Ignore case | Boolean | No | false | Ignore upper/lower case. |
| Occurrence | Number | No | 1 | Which match to return (1 = first, 2 = second ...). |
| Group | Number | No | 0 | Regular expression: return this capture group in match and all_matches instead of the whole match, e.g. 1 for the number in Total: (\d+). |
Outputs
| Output | Type | What it is |
|---|---|---|
| index | Number | Zero-based position of the match, or -1 when not found. |
| found | Boolean | True when a match was found. |
| match | String | The matched text (or the chosen group), empty when not found. |
| position | Number | One-based position of the match, or 0 when not found. |
| groups | List | Regular expression: the capture groups of the returned match (group 1 first); empty otherwise. |
| named_groups | Dictionary | Regular expression: named groups (?<name>...) of the returned match. |
| all_matches | List | Every match from the start position on, in order. |
| count | Number | How many matches there are from the start position on. |