Use the isUndefined helper rather than typeof in joinRegExp