Hi --

On Thu, 13 Jul 2006, Daniel Martin wrote:

> Daniel Schierbeck <daniel.schierbeck / gmail.com> writes:
>
>> I'm trying to write a regular expression that matches bencoded
>> strings, i.e. strings on the form x:y, where x is the numeric length
>> of y.
>>
>> This is valid:
>>
>>   6:foobar
>>
>> while this is not:
>>
>>   4:foo
>
> I don't think that what you want to do is possible with a mere regular
> expression.
>
> It might be possible using perl's special
> evaluate-code-while-in-regexp (??{ code }) feature, but not with any
> language that doesn't allow regular expression evaluations to escape
> back into the host language.

Is ??{ code } in Perl different from #{...} in Ruby?  (Not that I was
able to solve Daniel's problem with #{...}, but I'm just curious about
the comparison.)


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black     => RUBY FOR RAILS (reviewed on
                                     Slashdot, 7/12/2006!)
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
dblack / wobblini.net              => me