JuliaLang/julia — pull request #4002 by dcjones (2013-08-09 19:01:50+00:00)
Title: RFC: Regex improvments

This is a few changes I'd like to make to regex, which I can pick apart if there's not a consensus. This includes:

1. A dramatically faster `matchall` function that returns a `SubString` array. On John's benchmark in #3719 elapsed time goes from 5.63 seconds to 0.16 seconds. This is also about twice as fast as python. The version here fixes the code I originally posted, handling the weird empty match cases that `eachmatch` handles.
2. `match` returns and captures `SubString` objects.
3. PCRE's JIT is used in `eachmatch` and `matchall` (but not in match). This was a pretty significant improvement in the #3719 benchmark. I know in #324 it was decided not to use the jit, but using it just in `eachmatch` and `matchall` avoids the serialization issue and is more likely to have a pay off since the pattern is typically going to be applied many times.
4. Fix some weird special cases in `eachmatch` E.g. this previously incorrectly threw an exception: `collect(eachmatch(r"a?b?", "asbd", true))`.