Functions like string.match() and string.replace() can use regular expressions. According to the documentation, regular expressions are actually of the RegExp type. However, RegExp doesn't appear to be a valid type for a variable. i.e. the following code does not work
RegExp expression = /[0-9]/;
Is there any way to assign a regular expression to a variable? Or are all regular expressions required to be defined directly in the code?
The key reason I wanted to do this was to be able to dynamically construct a regular expression in code. Is there any way to do that in FlexScipt (e.g. constructing a string, then converting that string to a regular expression)?