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 469955
In Process

The Archive Base Latest Questions

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

I am using mechanize/nokogiri and need to parse out the following HTML string. can

  • 0

I am using mechanize/nokogiri and need to parse out the following HTML string.
can anyone help me with the xpath syntax to do this or any other methods that would work?

<table>
  <tr class="darkRow">
    <td>
      <span>
        <a href="?x=mSOWNEBYee31H0eV-V6JA0ZejXANJXLsttVxillWOFoykMg5U65P4x7FtTbsosKRbbBPuYvV8nPhET7b5sFeON4aWpbD10Dq">
            <span>4242YP</span>
        </a>
      </span>
    </td>
    <td>
      <span>Subject of Meeting</span>
    </td>
    <td>
      <span>
        <span>01:00 PM</span> 
        <span>Nov 11 2009</span> 
        <span>America/New_York</span>
      </span>
    </td>
    <td>
      <span>30</span>
    </td>
    <td>
      <span>
        <span>example@email.com</span>
      </span>
    </td>
    <td>
        <span>39243368</span>
    </td>
  </tr>
  .
  .
  .
  <more table rows with the same format>
</table>

I want this as the output

"4242YP","Subject of Meeting","01:00 PM Nov 11 2009 America/New_York","30","example@email.com", "39243368"
.
.
.
<however many rows exist in the html table>
  • 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-12T23:50:11+00:00Added an answer on May 12, 2026 at 11:50 pm

    something like this?

    items=doc.xpath('//tr').map {|row| row.xpath('.//span/text()').select{|item| item.text.match(/\w+/)}.map {|item| item.text} }
    

    returns:
    => [[“4242YP”, “Subject of Meeting”, “01:00 PM”, “Nov 11 2009”, “America/New_York”, “30”, “example@email.com”, “39243368”], [“abcdefg”]]

    Select includes only spans that start with word characters (e.g. excluding the whitespace that some of your spans have). You may need to refine the “select” filter for your specific case.

    I added a minimalist row that contained a span containing abcdefg, so that you can see the nested array.

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

Sidebar

Related Questions

what is the best method using ruby/mechanize/nokogiri to go/click through all pages in case
can I get the correct data/text that is displayed via AJAX using mechanize in
I'm using WWW::Mechanize to retrieve a webpage. I need to check if the page
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using C#, I need a class called User that has a username, password, active
I've been trying to write a ruby script using mechanize to batch upload a
I'm using Mechanize to extract the links from the page. To ease with development,
Currently I'm using Mechanize and the get() method to get each site, and check

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.