views:

43

answers:

1

My sinatra app runs fine locally but when I push it to heroku it crashes and I get this error

RegexpError - undefined (?...) sequence: /(?<=(LIST ALL SELECTED ))\w/:

The line of code where the occurs is

match = data.match('(?<=(LIST ALL SELECTED ))\w')[0]

What I am trying to do is capture the next letter directly after 'LIST ALL SELECTED '

Any insite to what this means would be greatly appreciated.

Thanks.

+1  A: 

That's what's called a positive lookbehind. Ruby doesn't support them, but if that's the whole regexp, you don't need it.

match = data.match(/LIST ALL SELECTED(\w)/)[0]

Ben (look down, in the comments) says your regexp with the lookbehind does indeed work on Ruby 1.9.2. Heroku must be using 1.8.6 or 1.8.7, which doesn't have lookbehinds.

AboutRuby
No offence, but it doesn't work on Ruby 1.8. Also, upgrade from rc2.
AboutRuby
What error do you get when you try the regex AR posted? Does it work any better passed as a String ('') than as a Regex (//) ?
lxs
@lxs I rewrote the code to eliminate the positive lookbehind, pushed to heroku and it worked fine. From what I could find on the internets heroku is running on Ruby 1.8.6.
Ben