unknown regexp options

G

Gary Rutledge

When I try to "require", "load" or use rdoc on a .rb file in IRB I get
the error

"SyntaxError: compile error
(irb):5: unknown regexp options - gary
from (irb):5"


Also, i'm using the preloaded irb on my mac which uses ">>" instead of
"irb(main):002:0>" at the command line. It'd be nice to have that
feature to know if I'm still coding within an object.

I can't seem to find anything on either problem on the net. Your help is
greatly appreciated!
 
S

Stefano Crocco

|When I try to "require", "load" or use rdoc on a .rb file in IRB I get
|the error
|
|"SyntaxError: compile error
|(irb):5: unknown regexp options - gary
| from (irb):5"
|
|
|Also, i'm using the preloaded irb on my mac which uses ">>" instead of
|"irb(main):002:0>" at the command line. It'd be nice to have that
|feature to know if I'm still coding within an object.
|
|I can't seem to find anything on either problem on the net. Your help is
|greatly appreciated!

I don't have a mac, so I'm guessing. Have you perhaps a .irbrc file in your
home directory? If so, then maybe that is the cause for both behaviours you
get. Try running irb with the -f command line option, which disables reading
the .irbrc file, and see what happens.

Regarding the prompt issue, the >> prompt can be obtained by using the
--simple-prompt command line option, so maybe you can override this passing
the --prompt-mode default option.

I hope this helps

Stefano
 
B

Brian Candler

Gary said:
Still getting the unknown regexp though, even with the -f command.

Can you show *exactly* what you type, and exactly what response you get?

Also, what do you get from

ENV.select { |k,v| k =~ /RUBY/ }

?
 
A

Alex Gutteridge

Thanks for you help Stefano!

I can't find a .irbrc file, and my mac is set up so hidden files are
shown so that's not the problem.

Running irb -f does show the "irb(main):001:0>" , so that's half the
battle!

Still getting the unknown regexp though, even with the -f command.

any ideas?

You need to post your full irb session and the file you are trying to
require/load. The error looks like at some point in your file you must
write:

/ThisIsYourRegExp/gary

Which to Ruby looks like you are trying to give the options 'gary' to the
RegExp. Given the coincidence of your name, I would suggest you have a
simple syntax error in the file you are trying to load.
 
G

Gary Rutledge

The content of the file is just:

puts "test"

The irb session is:
SyntaxError: compile error
(irb):3: unknown regexp options - gary
from (irb):3
The .rb file was written in textedit with no rich text. I was using
netbeans and my theory was that netbeans was throwing in some meta data
with the file location that ruby was picking up and processing as a
regular expression. But textedit is the same so I don't think that's the
problem.
 
S

Stefano Crocco

|The content of the file is just:
|
|puts "test"
|
|The irb session is:
|>> load /Users/gary/Desktop/test.rb
|
|SyntaxError: compile error
|(irb):3: unknown regexp options - gary
| from (irb):3
|
|
|The .rb file was written in textedit with no rich text. I was using
|netbeans and my theory was that netbeans was throwing in some meta data
|with the file location that ruby was picking up and processing as a
|regular expression. But textedit is the same so I don't think that's the
|problem.

The path of the file should be a string:

load '/Users/gary/Desktop/test.rb'

Stefano
 
R

Rob Biedenharn

The content of the file is just:

puts "test"

The irb session is:

Try:

load "/Users/gary/Desktop/test.rb"

Otherwise, it looks like a literal regular expression.

-Rob
SyntaxError: compile error
(irb):3: unknown regexp options - gary
from (irb):3

The .rb file was written in textedit with no rich text. I was using
netbeans and my theory was that netbeans was throwing in some meta
data
with the file location that ruby was picking up and processing as a
regular expression. But textedit is the same so I don't think that's
the
problem.

Rob Biedenharn
(e-mail address removed) http://AgileConsultingLLC.com/
(e-mail address removed) http://GaslightSoftware.com/
 
H

heaphyg

Ah, You're dead right there. Works perfectly now!

Thanks for the help :)

Gary I am brand new to programming and I have the same problem that you expressed at the top of the page. However, I don't understand the solution that was put forth. Would you mind explaining it to me knowing that I have no idea whats going on?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top