alias -l safeRegex return $regsubex($1-, /([^a-z\d_-])/g, \E\ $+ \t $+ \Q)
if (*word* isin $strip($1-)) {
;; matches for "word" anywhere in text
}
elseif ($regex($strip($1-), /\b\Q $+ $safeRegex(word) $+ \E\b/i)) {
;; matches "word" as a whole word only (can be preceded or followed by punctuation)
}
elseif ($regex($strip($1-), /\b\Q $+ $safeRegex(word) $+ \E/i)) {
;; matches if "word" is the start of a word(can have punctuation before, anything after)
}
elseif ($regex($strip($1-), /\Q $+ $safeRegex(word) $+ \E\b/i)) {
;; matches if "word" is the end of a word (anything before, punctuation after)
}