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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:10:01+00:00 2026-05-30T09:10:01+00:00

/<table[\s]+cellspacing=0[\s]+class=cj(?:.*?)[\s]+id=(?:.*?)>(?:.*?)value=(.*?)(?:.*?)<td[\s]+class=dep>(.*?)<\/td>(?:.*)(?:<td[\s]+class=arr>(.*?)<\/td>)+(?:.*?)<\/table>/ This is my current regex string, used in PHP with preg_match_all() . I

  • 0
/<table[\s]+cellspacing="0"[\s]+class="cj(?:.*?)"[\s]+id="(?:.*?)">(?:.*?)value="(.*?)"(?:.*?)<td[\s]+class="dep">(.*?)<\/td>(?:.*)(?:<td[\s]+class="arr">(.*?)<\/td>)+(?:.*?)<\/table>/

This is my current regex string, used in PHP with preg_match_all(). I replaced (?:.*?) with (?:.*) so that instead of getting the first <td> with class="dep", it gets the last one. Now, this works perfectly, unless there is more than one table, in which case it gets the last <td> with class="dep" from the entire parsed string. Can anyone help me understand what I did wrong?

Also, I know I should have used XML parsing, but it seemed way too complicated for me 😛

Edit: Also, what I actually want is the <td> that is before the first </table> tag.

  • 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-30T09:10:03+00:00Added an answer on May 30, 2026 at 9:10 am

    Ended up fixing it by getting the table with one regex, then parsing its contents with another.

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

Sidebar

Related Questions

Take a look at this table: <table cellpadding=0 cellspacing=0 class=order_form> <tr> <th>Amount</th> <th>Desc</th> <th>Price</th>
This is my markup: <table class=col1table cellspacing=0 cellpadding=0> <tr> <td><a class=tips_trigger href=#><img src=/img/design/icon_tips_venn.png /></a></td>
<table cellpadding=1 cellspacing=1 id=member><thead> <tr> <th>&nbsp;</th> <th>Gracz</th> <th>Ludność</th> <th>Osady</th><th>&nbsp;</th></tr></thead><tbody><tr> <td class=ra>1.</td><td class=pla><a href=spieler.php?uid=5473>rafal12</a></td><td class=hab>8801</td>
<table cellspacing=0 cellpadding=0> <textarea rows=5 cols=60 name=question></textarea> <tr> <td><input type=text readonly=1 value=127.0.0.1 /></td> <td><input
I have a table layout with the following code <table cellspacing=0 class=photogalleryTable> <tbody> <tr>
So far, I'm doing this programmatically using VB.net/ASP.net: <table cellspacing=0 cellpadding=4 border=0 style=border- width:0px;width:100%;border-collapse:collapse;font-size:12px;>
I have a table as follows <table id=vainTbl6 class=dtable cellpadding=3 cellspacing=1 border=0> <thead> <tr><th>check</td><th>Morphosal</th><th>goat
We have the following form: <form> ... <table width=100% cellspacing=0 class=datagrid_ppal> <tbody> <tr> <th
<form action= method=post id=SaveIndicationsExportForm> <table cellspacing=0 cellpadding=0 id=hover style=float: left;> <tbody> <tr> <td class=hoverButtonLeft
I have this input text: <html><head><meta http-equiv=content-type content=text/html; charset=utf-8></head><body><table cellspacing=0 cellpadding=0 border=0 align=center width=603>

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.