Skip to main content

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​

InputTypeRequiredDefaultWhat it is
TextStringYesText to search in.
FindStringYesText or regular expression to look for.
Find is a regular expressionBooleanNofalseTreat 'find' as a regular expression.
StartNumberNo0Zero-based position to start searching from.
Ignore caseBooleanNofalseIgnore upper/lower case.
OccurrenceNumberNo1Which match to return (1 = first, 2 = second ...).
GroupNumberNo0Regular 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​

OutputTypeWhat it is
indexNumberZero-based position of the match, or -1 when not found.
foundBooleanTrue when a match was found.
matchStringThe matched text (or the chosen group), empty when not found.
positionNumberOne-based position of the match, or 0 when not found.
groupsListRegular expression: the capture groups of the returned match (group 1 first); empty otherwise.
named_groupsDictionaryRegular expression: named groups (?<name>...) of the returned match.
all_matchesListEvery match from the start position on, in order.
countNumberHow many matches there are from the start position on.