STRING::FIND_ALL 1g 2024-03-25 laplante@plcb.ca GOWEB/STRING — Find All Regex Matches in a String


title: “STRING::FIND_ALL” version: “1.0.0” date: 2024-03-25 author: “laplante@plcb.ca” section: “1g” category: “GOWEB/STRING”


Name

string::find_all Find All Regex Matches in a String

Synopsis

string::find_all(string, re/.../ [, nbmatch: int])
find_all(string, re/.../ [, nbmatch: int])
string::findAll(string, re/.../ [, nbmatch: int])
findAll(string, re/.../ [, nbmatch: int])

Description

The find_all function returns an array containing all successive matches of a given regular expression within a string.

By default, all matches are returned. If the optional nbmatch parameter is provided, it limits the number of matches returned.


Parameters


Examples

"2="; find_all("Pierre  56a Laplante 65b chantal 72c caroline", re/(\d+[a-z]+)/); "\n";
"3="; find_all("seafood fool", re/foo.?/);

Returns:

2 = ["56a","65b","7c"]
3 = ["food","fool"]

Author


See Also


Version History