From: Daniel Schierbeck Date: 2006-07-12T23:10:12+09:00 Subject: Help with a regexp 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've tried using #{$1} inside the regexp, but it seems $1 is still nil at that point. Here's what I've got so far: /^([1-9]+\d*):(\w){#{$1}}$/ (it ain't working) I'm matching with `string =~ regexp'; would it be better if I did it another way? Cheers, Daniel