in reply to Partitioning a set of strings by regular expressions

You may find Short, Self-Contained, Correct Example and in particular How to ask better questions using Test::More and sample data useful when trying to specify algorithm behavior to the monks — and even to yourself!


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Partitioning a set of strings by regular expressions
by Locutus (Beadle) on May 12, 2020 at 14:48 UTC

    Thanks for these pointers, AnomalousMonk!

    If I already had some code to let the monks look at I'd be happy to follow your advice. By giving a very simplified example of data to work on I tried to be both short and self-contained without "hiding" my post from other seekers with a completely different instance of the same general problem. That my original post triggered one or two questions asked back to me (which I think I have answered in a prompt manner) might rather be due to the fact that this is a communication platform than due to an inefficiently stated problem description?

      That my original post triggered one or two questions asked back to me (which I think I have answered in a prompt manner) might rather be due to the fact that this is a communication platform than due to an inefficiently stated problem description?

      This is indeed a communication platform, and discussions are very welcome to help find the best solution. As for the problem statement, while not bad and stated quite formally, IMHO it oversimplifies a little bit too much: the test cases you named are so simple (only repeating letters) that it could be solved with very simple solutions that wouldn't have adressed your actual problem - so it definitely wouldn't hurt to mention that you're actually trying to parse citations, lest it become an XY Problem. (Note Short, Self-Contained, Correct Example generally refers to the code, not necessarily the problem statement.)

      IMHO in this case it sounds like developing heuristics with some validation, like what jcb described, while not as nice and "pure" of a solution, will probably get you up and running fastest.