in reply to Re^2: (Golf) Cryptographer's Tool #2
in thread (Golf) Cryptographer's Tool #2
Remember that one 7-bit character, the space, is being used as puncuation, so there really are at most 126 characters in the alphabet.
The use of word-boundaries (\b) to match the words is rather strange here, because we're using words that don't necessarily consist of "word characters". For example, if $n and $a were 2 and 4, that regex would match ('this', '-is!', 'one+', word') in 'this-is!one+word?'.
Negative look-ahead/-behind assertions are necessary for this approach: /(?<! )[^ ]{$n,$a}(?! )/g
|
|---|