Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > unknown regexp options

Reply
Thread Tools

unknown regexp options

 
 
Gary Rutledge
Guest
Posts: n/a
 
      09-29-2010
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!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Stefano Crocco
Guest
Posts: n/a
 
      09-29-2010
On Wednesday 29 September 2010, Gary Rutledge wrote:
> |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

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      09-29-2010
Gary Rutledge 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/ }

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

 
Reply With Quote
 
Alex Gutteridge
Guest
Posts: n/a
 
      09-29-2010
On Wed, 29 Sep 2010 20:48:42 +0900, Gary Rutledge <(E-Mail Removed)>
wrote:
> 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.

--
Alex Gutteridge

 
Reply With Quote
 
Gary Rutledge
Guest
Posts: n/a
 
      09-29-2010
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.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Stefano Crocco
Guest
Posts: n/a
 
      09-29-2010
On Wednesday 29 September 2010, Gary Rutledge wrote:
> |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

 
Reply With Quote
 
Rob Biedenharn
Guest
Posts: n/a
 
      09-29-2010

On Sep 29, 2010, at 9:16 AM, Gary Rutledge 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

> 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.
> --
> Posted via http://www.ruby-forum.com/.
>


Rob Biedenharn
http://www.velocityreviews.com/forums/(E-Mail Removed) http://AgileConsultingLLC.com/
(E-Mail Removed) http://GaslightSoftware.com/


 
Reply With Quote
 
Gary Rutledge
Guest
Posts: n/a
 
      10-01-2010
Ah, You're dead right there. Works perfectly now!

Thanks for the help
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
heaphyg@gmail.com
Guest
Posts: n/a
 
      08-29-2013
On Friday, October 1, 2010 7:43:37 AM UTC-4, Gary Rutledge wrote:
> Ah, You're dead right there. Works perfectly now!
>
> Thanks for the help
> --
> Posted via http://www.ruby-forum.com/.


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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[regexp] How to convert string "/regexp/i" to /regexp/i - ? Joao Silva Ruby 16 08-21-2009 05:52 PM
Performance issue in multi-level Oracle Object/thin JDBC Options Options jacksu Java 0 10-09-2007 08:21 PM
good compile options for g++ options to enforce good coding Cliff Martin C++ 1 01-31-2007 02:03 AM
parsing unknown options Stefano Crocco Ruby 7 11-15-2006 05:29 PM
Assign an unknown value to an unknown variable Vincent Arnoux Ruby 1 08-11-2006 06:12 PM



Advertisments