its working here :
rituraj@rituraj:~$ irb
2.1.1 :001 > s = "somestring 23 and 34 and 233"
=> "somestring 23 and 34 and 233"
2.1.1 :002 > s.scan(/(?<!\d)[0-3]?\d(?!\d)/)
=> ["23", "34"]
check your ruby version:
Ruby's regex engine doesn't support lookbehind which is less than 1.9.
You'd need to switch to 1.9+.
optional usage : you can use oniguruma