Unknown regexp options

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!

On Wednesday 29 September 2010, Gary R. wrote:

|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

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?

On Wed, 29 Sep 2010 20:48:42 +0900, Gary R. [email protected]
wrote:

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.

Gary R. wrote:

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/ }

?

On Wednesday 29 September 2010, Gary R. wrote:

|
|
|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

On Sep 29, 2010, at 9:16 AM, Gary R. wrote:

The content of the file is just:

puts “test”

The irb session is:

load /Users/gary/Desktop/test.rb

Try:

load “/Users/gary/Desktop/test.rb”

Otherwise, it looks like a literal regular expression.

-Rob

the
problem.

Posted via http://www.ruby-forum.com/.

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/

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

Thanks for the help :slight_smile:

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs