Wraps the creation of the regex in a try/catch and returns the regex, wrapped in an option,
when it is valid. This can be used, for example, in a text field where the user types a regex.
Parameters
regexString: string
The string representation of the regex
Returns Option<RegExp>
The regular expression (RegExp) wrapped in an option. If the regexp
is invalid, then the option is none.
Wraps the creation of the regex in a try/catch and returns the regex, wrapped in an option, when it is valid. This can be used, for example, in a text field where the user types a regex.