extract_regex_group function:

Return the capture group within the string. The first argument is expected to be the string to apply the expression on. The second argument is expected to be the string with the regular expression. The third argument is expected to be the group index with in the regular epression (the first group index is one). For regular expression syntax, see https://docs.rs/regex/latest/regex/#syntax. Use --regular_expression_cache_size so set a cache for compiled regular expressions.

Examples:

  • running: (extract_regex_group "hello 200 world", "[a-z ]+([0-9]+)[a-z ]+", 1) will give: "200" Because the regular expression is letters and spaces, group with numbers, and more letter and spaces, so the group is the string "200".

  • running: (extract_regex_group "hello 200 world", "[a-z ]+([0-9]+)[a-z ]+", 20) will return nothing

  • running: (extract_regex_group "hello 200 world", "[a-z ]+([0-9]+)[a-z ]+", 0) will give: "hello 200 world"

  • running: (extract_regex_group "test", "[0-9", 10) will return nothing