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

  • SEARCH
  • Home
  • 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 7502375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:50:51+00:00 2026-05-29T20:50:51+00:00

I am trying to write a program using the lynx command on this page

  • 0

I am trying to write a program using the lynx command on this page “http://www.rottentomatoes.com/movie/box_office.php” and I can’t seem to wrap my head around a certain problem…. getting the title by itself. My problem is a title can contain special characters, numbers, and all titles are variable in length. I want to write a regex that could parse the entire page and find lines like this….
(I added spaces between the title and the next number, which is how many weeks it has been out, to distinguish between title and weeks released)

1 -- 30%  The Vow                                           1 $41.2M $41.2M $13.9k 2958
2 -- 53%  Safe House                                        1 $40.2M $40.2M $12.9k 3119
3 -- 42%  Journey 2: The Mysterious Island                  1 $27.3M $27.3M $7.9k 3470
4 -- 57%  Star Wars: Episode I - The Phantom Menace (in 3D) 1 $22.5M $22.5M $8.5k 2655
5 1  86%  Chronicle                                         2 $12.1M $40.0M $4.2k 2908

the regex I have started out with is:

/(\d+)\s(\d+|\-\-)\s(\d+\%)\s

If someone can help me figure out how to grab the title successfully that would be much appreciated! Thanks in advanced.

  • 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-29T20:50:52+00:00Added an answer on May 29, 2026 at 8:50 pm

    Capture all the things!!

    ^(\d+)\s+(\d+|\-\-)\s+(\d+\%)\s+(.*)\s+(\d+)\s+(\$\d+(?:.\d+)?[Mk])\s+(\$\d+(?:.\d+)?[Mk])\s+(\$\d+(?:.\d+)?[Mk])\s+(\d+)$
    

    Explained:

    ^                            <- Start of the line
        (\d+)\s+                 <- Numbers (captured) followed by as many spaces as you want
        (\d+|\-\-)\s+            <- Numbers [or "--"] (captured) followed by as many spaces as you want
        (\d+\%)\s+               <- Numbers [with '%'] (captured) followed by as many spaces as you want
        (.*)\s+                  <- Anything you can match [don't be greedy] (captured) followed by as many spaces as you want
        (\d+)\s+                 <- Numbers (captured) followed by as many spaces as you want
        (\$\d+(?:.\d+)?[Mk])\s+  <- "$" and Numbers [with floating point] and "M or k" (captured) followed by as many spaces as you want
        (\$\d+(?:.\d+)?[Mk])\s+  <- "$" and Numbers [with floating point] and "M or k" (captured) followed by as many spaces as you want
        (\$\d+(?:.\d+)?[Mk])\s+  <- "$" and Numbers [with floating point] and "M or k" (captured) followed by as many spaces as you want
        (\d+)                    <- Numbers (captured)
    $                            <- End of the line
    

    So to be serious this is what I’ve done, I cheated a bit and captured everything (as I think you’ll do in the end) to get a lookahead for the title capture.

    In a non-greedy regex (.*) [or (.*?) if you want to force the “ungreedyness”] will capture the least possible characters, and the end of the regex tries to capture everything else.

    Your regex ends up capturing only the title (the only thing left).

    What you can do is using an actual lookahead and make assertions.


    Resources:

    • regular-expressions.info – Lookaround
    • regexr.com – This regex tested
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a program that cleans data, using Matlab. This program takes
I'm trying to write a program that can stop and start services using SilverLight
I'm trying to write a secure transfer file program using Python and AES and
I trying to write a program that navigates the local file system using a
I am trying to write a hello world type program for using virtual channels
I am trying to write a GUI program for a command line program in
I am trying to write a python program using Python 3 I have to
I am using Python 3.0 to write a program. In this program I deal
I am trying to write a program using python-fuse, but I can't get file
I'm trying to write a simple program using WinSnmp in C++. There is very

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.