Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Brighton, UK
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple RegEx Problem

    *** Dont worry, i worked it out, cheers ***

    Hi,

    Im new to using regular expressions in PHP, and kinda confused about what all the different functions do. But basically, i have the conents of an HTML file in variable called $input and i need a function and expression that will find the position of the first TABLE tag in that string.

    Infact the end result needs to be a string with just the table in, everything from <table.....> to </table>. If there is an even easier way to do this it would be great.

    Thanks in advance.

    Jack
    Last edited by Jak-S; 10-15-2005 at 03:28 PM.

  • #2
    New Coder
    Join Date
    Sep 2005
    Location
    Latina (Italy)
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just try something like this:
    PHP Code:
    /* I suppose $htmlString is a string with your whole HTML file */
    $eregMatches = array();
    $found eregi'(<table>(.+)</table>)' $htmlString $eregMatches );
    if(
    $found)
        
    $tabContent $eregMatches[1];
    /* tabContent has the <table>...</table> stuff in */ 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •