In case if anybody got this error while developing a regex, make sure to wrap your regex with forward slashes.
Regex Delimiters (/).