unknown regexp options

Discussion in 'Ruby' started by Gary Rutledge, Sep 29, 2010.

  1. 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/.
     
    Gary Rutledge, Sep 29, 2010
    #1
    1. Advertising

  2. 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
     
    Stefano Crocco, Sep 29, 2010
    #2
    1. Advertising

  3. 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/.
     
    Brian Candler, Sep 29, 2010
    #3
  4. On Wed, 29 Sep 2010 20:48:42 +0900, Gary Rutledge <>
    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
     
    Alex Gutteridge, Sep 29, 2010
    #4
  5. 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/.
     
    Gary Rutledge, Sep 29, 2010
    #5
  6. 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
     
    Stefano Crocco, Sep 29, 2010
    #6
  7. 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://AgileConsultingLLC.com/
    http://GaslightSoftware.com/
     
    Rob Biedenharn, Sep 29, 2010
    #7
  8. Gary Rutledge, Oct 1, 2010
    #8
  9. Gary Rutledge

    Guest

    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?
     
    , Aug 29, 2013
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cliff  Martin
    Replies:
    1
    Views:
    3,042
    Larry Smith
    Jan 31, 2007
  2. jacksu
    Replies:
    0
    Views:
    513
    jacksu
    Oct 9, 2007
  3. Vincent Arnoux
    Replies:
    1
    Views:
    251
    Arnaud Bergeron
    Aug 11, 2006
  4. Stefano Crocco

    parsing unknown options

    Stefano Crocco, Nov 13, 2006, in forum: Ruby
    Replies:
    7
    Views:
    212
    Jeremy Hinegardner
    Nov 15, 2006
  5. Joao Silva
    Replies:
    16
    Views:
    366
    7stud --
    Aug 21, 2009
Loading...

Share This Page