|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
grep problem under NetBeans 6.1 WindowsIs this the right forum to post problems?
The following 3-line script fails under NetBeans (returns Nil) but works when running Ruby from the console or in SciTE (returns ["a", "b"]). x = ["fa"] p = /^f(.+)$/ puts x.grep(p){|z| Regexp.last_match(1)} However this script works the same in all the environments (returns ["fa", "fb"]). x = ["fa", "fb"] p = /^f(.+)$/ puts x.grep(p){|z| z} I have tried this with both Ruby platforms in NetBeans and the result is the same. It also doesn't matter whether I am running in Debug mode or Run mode. I installed the JDK freshly for the NetBeans install. Any suggestions on what else I should try? I am on Windows XP Pro, SP2 Can others duplicate the problem? |
|
|
Re: grep problem under NetBeans 6.1 Windowswrishel wrote:
> Is this the right forum to post problems? > > The following 3-line script fails under NetBeans but works when running Ruby > from the console or in SciTE > > x = ["fa"] > p = /^f(.+)$/ > #puts x[0], x[0] =~ p > puts x.grep(p){|z| Regexp.last_match(1)} > > If you uncomment the commented line, then the script works in NetBeans. > > I have tried this with both Ruby platforms in NetBeans and the result is the > same. It also doesn't matter whether I am running in Debug mode or Run mode. > I installed the JDK freshly for the NetBeans install. > > Any suggestions on what else I should try? > > Can others duplicate the problem? If you mean by the 'fail' that from within NetBeans it prints 'nil' and from CLI it prints 'a' it is probable that you are using bundled JRuby from within the NetBeans which itself causes this bug So it is a bug in broken JRuby's Regexp.last_match implementation when called from within the Enumerable.grep's block (likely). I've filed: http://jira.codehaus.org/browse/JRUBY-2489 If it is not the case, let me know. Regards, m. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: grep problem under NetBeans 6.1 WindowsGosh.
I *though* I had tried this in both Jruby and CRuby but after reading your note I went back and realized that I had misunderstood the directions for changing platforms. With my newbie error corrected, it is clear that the problem is associated with JRuby. Thanks for your timely response.
|
| Free Forum Powered by Nabble | Forum Help |