Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top