A regex for another thread: it shares the compiled pattern (parse, programs and one-pass table) with re and has a search
cache of its own, so it costs far less than a second compile. Free it with free_regex, like any other regex.
Clone before the threads start, or from the thread that owns re: re must not be freed while clone runs. After that,
the regexes can be freed in any order and on any thread; the shared part goes with the last one. Memory for the clone and its
cache comes from context.allocator, so free it with the same allocator.
Regex :: #import "Extensions/Regex";
re, _ := Regex.compile("[0-9]+");
copy := Regex.clone(*re);
Regex.free_regex(*re); // the clone keeps the pattern alive
assert(Regex.is_match(*copy, "room 101"));
Regex.free_regex(*copy);clone :: (re: *Regex) -> Regex
Parameters
- re: *Regex