Skip to main content

Text.find

findpatterncase_sensitivity

Group: Selections
Aliases: match

Documentation

Find the regular expression pattern in self, returning the first match if present or Nothing if not found. For details on Enso's Regex syntax, see the Help Documentation.

Arguments

  • pattern: The pattern to match self against.
  • case_sensitivity: Specifies if the text values should be compared case sensitively.

Examples

Find the first substring matching the regex.

      example_find =
## This matches `abc` @ character 11
"aabbbbccccaabcaaaa".find "a[ab]c"
example_find_insensitive =
## This matches `aBc` @ character 11
"aabbbbccccaaBcaaaa".find "a[ab]c" Case_Sensitivity.Insensitive

Errors

  • If an empty regex is used, find throws an Illegal_Argument error.
  • If a non-default locale is used, find throws an Illegal_Argument error.