util.regexStr - GavriYashar/Matlab-Utilities GitHub Wiki

This function is used to search through an array of strings for occurrences of an regular expression.

usage example

str = ["Foo", "Bar", "FooBar";
       "sthElse", "1234", "text"];

idx = util.regexStr(str, "\d+")

idx =
  2×3 logical array
   0   0   0
   0   1   0

match = str(idx)

Using just the regexp function (res = regexp(str, expr, ignorecase, "once")) would return a cell array:

res =
  2×3 cell array
    {0×0 double}    {0×0 double}    {0×0 double}
    {0×0 double}    {[       1]}    {0×0 double}