Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:08:12+00:00 2026-05-26T23:08:12+00:00

I have the following 2 regular expressions in a ruby file. They run fine

  • 0

I have the following 2 regular expressions in a ruby file. They run fine when i use the ruby command but if i try to run via ./apachereport.rb it generates an error.

regex:

urls = parse(@file, /(?<=GET )\S+/)
codes = parse(@file, /(?<=HTTP\/[0-9]\.[0-9]" )\S+/)

error:

./apachereport.rb:34: undefined (?...) sequence: /(?<=GET )\S+/
./apachereport.rb:47: undefined (?...) sequence: /(?<=HTTP\/[0-9]\.[0-9]" )\S+/

The shebang I’m using is as follows, which seems to work fine with other ruby files:

#!/usr/bin/ruby
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:08:13+00:00Added an answer on May 26, 2026 at 11:08 pm

    The most likely explanation for this is that you have multiple versions of ruby installed. The version installed in /usr/bin (which is the one you’re using in your shebang line) is 1.8.X, which did not support ?<= (look-behind) in regexen. The one you execute when you type ruby apachereport is probably ruby 1.9, which does support ?<=.

    To verify that this is the case type in which ruby and notice that it prints something other than /usr/bin/ruby and/or compare the results of /usr/bin/ruby --version to ruby --version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following two strings containing regular expressions. How do I coalesce
I'm a newbie to regular expressions and I have the following string: sequence =
I have the following regular expression that works fine in perl: Classification:\s([^\n]+?)(?:\sRange:\s([^\n]+?))*(?:\sStructural Integrity:\s([^\n]+))*\n The
i have the following two regular expressions (in order btw). 1. ^~/buying/(.*)\?(.*) => foo=
I have the following text: abcabcabcabc<2007-01-12><name1><2007-01-12>abcabcabcabc<name2><2007-01-11>abcabcabcabc<name3><2007-02-12>abcabcabcabc<name4>abcabcabcabc<2007-03-12><name5><date>abcabcabcabc<name6> I need to use regular expressions in order
Using .NET regular expressions. Let's say I have the following text: ddddddddddd And I
I have a few regular expressions which are run against very long strings. However,
I have the following value: start=2011-03-10T13:00:00Z;end=2011-03-30T13:00:00Z;scheme=W3C-DTF I use the following regular expression to strip
I have the following site and I want with regular expressions to get the
If we have the following lines <something>A<else> <something>B<else> <something>C<else> Using regular expressions in Notepad++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.