strfind()
is a function that finds the starting index of the first occurrence of a substring within a larger string. For example:
main.m59 chars3 lines
regexp()
is a function that finds one or multiple matches of a regular expression within a larger string. For example:
main.m135 chars3 lines
The first argument to regexp()
is the string to search within. The second argument is the regular expression to match. The third optional argument is a flag to indicate if the function should return all the matches or just the first one (default).
In short, strfind()
is used to find a substring within a larger string, while regexp()
is used to find one or more matches of a regular expression within a larger string.
gistlibby LogSnag