in reply to regex finding shortest string containing n of $c

Your expected results do not match your description - I would have expected line 4 to contain 4 x's.

It is not obvious that the longest string will be bounded by $c. Or do you mean that the longest string must be terminated at each end by $c such that, if $n == 1, then ".....x......" is not acceptable, but 'x' is?

I doubt that using a regex is the most efficient way to solve this. Is it a requirement?


Perl is Huffman encoded by design.
  • Comment on Re: regex finding longest string containing n of $c

Replies are listed 'Best First'.
Re^2: regex finding longest string containing n of $c
by xipho (Scribe) on Sep 01, 2005 at 04:03 UTC
    I did mess up- meant shortest (see change in title). I think this then implies the bounding I mentioned? I don't need a regex- was just curious if such was possible. Thanks for the help.

      You should change your question too. Best to <strike> the incorrect text (so others can see what the fuss was about) and add the correct text.


      Perl is Huffman encoded by design.