The VM should support a simple regular expression type and various operations for compiling regular expressions, finding matches, etc. The compiler / runtime in turn should use this. There are two ways this can be exposed to the language:
- Python style where a "regex" module is used to compile a regular expression from a string
- Ruby style where regex literals (e.g.
/foo/) are used, and preferably the regex (at least for literals) is compiled when parsing the bytecode