in reply to Re: Problem with a text-parsing regex
in thread Problem with a text-parsing regex

The instructions were that "--" was to be treated like a space, so presumably should not be part of the punctuation runs - I think it should print {|o'clock|}, for example, not {|o'clock|--}.

I do prefer your version of the word parsing to mine, but I suspect (?: '-? | -'? ) is what's intended. (There aren't any examples of "word-'word" in the test cases though - I could probably come up with one in Dutch, but I imagine they're pretty rare in English.)

Replies are listed 'Best First'.
Re^3: Problem with a text-parsing regex
by ibm1620 (Hermit) on May 09, 2022 at 13:16 UTC
    I grepped my collection of text files (all English-language downloads from gutenberg.org) for -' and only found forty-'leven and fellow-'prentice. I've updated tybalt89's solution with your improvement.

    The contents of $3 will contain a final space if one is present, so {|o'clock|--} is consistent with the instructions.