0

I keep seeing undefined (?...) sequence: something. For this particular one I had..

/(?<!\d)[0-3]?\d(?!\d)/

but this has happened a few times to me and I'm not sure how to fix it.

These always work in rubular, but then i get that error when I run it?

Help please!

Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
user3606254
  • 165
  • 1
  • 5
  • 1
    Please provide what you have tried so far. – hwnd May 08 '14 at 05:45
  • It would help if you could explain what you are trying to accomplish with your regex. I see a negative lookbehind and a negative lookahead, both involving a single digit. An example with your desired result would be very helpful. Please elaborate by editing rather than trying to do so in a comment. – Cary Swoveland May 08 '14 at 05:46

1 Answers1

0

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

aelor
  • 10,892
  • 3
  • 32
  • 48