Post #2280772
2025-10-30 09:58 UTC
@jbert@hachyderm.io I haven't tried implementing it yet, but I suspect that you could handle this by running parallel groups in a similar way to how traditional regex engines handle alternations: so each group is running the underlying regex search for the next match in parallel and whichever matches first is run, and since overlapping matches are disallowed we know that we start the next search from the end of whatever we just matched.
Given that the initial implementation of this (both in Sam and my own use case in ad) is for a text editor where we know we have the full (finite) input, its a lot simpler to handle things in two passes.
Replies (1)
-
@jbert@hachyderm.io 2025-10-30 11:58
@sminez@hachyderm.io i think you can do the same with streaming, _if_ you know all the matching which needs to happen on a chunk (or up to an offset) has happened? Hence API above. I get that the parallel bit was hard, but it sounds like you have got that working for non-streaming case (well done :-) ) I think I mean...run your first pass on the stream and periodically ask your matchers for the offset they are finished with. You can then run your second pass on the stream up to that point, emit and discard.