code: function match(pattern) {
      return function(s) {
        return Z.map (toMatch,
                      Z.reject (equals (null), Just (s.match (pattern))));
      };
    }
docs: # match :: NonGlobalRegExp -> String -> Maybe { match :: String, groups :: Array (Maybe String) } . . Takes a pattern and a string, and returns Just a match record if the . pattern matches the string; Nothing otherwise. . . `groups :: Array (Maybe String)` acknowledges the existence of optional . capturing groups. . . Properties: . .   - `forall p :: Pattern, s :: String. .      S.head (S.matchAll (S.regex ('g') (p)) (s)) .      = S.match (S.regex ('') (p)) (s)` . . See also [`matchAll`](#matchAll). . . ```javascript . > S.match (/(good)?bye/) ('goodbye') . Just ({match: 'goodbye', groups: [Just ('good')]}) . . > S.match (/(good)?bye/) ('bye') . Just ({match: 'bye', groups: [Nothing]}) . ```