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
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts

    Getting a larger piece of matched text

    Thanks guys for the great help on breaking those strings apart, and adding html tags. Now i have another idea, i can't pull out myself. It's something like this.
    When using that function which matches strings, i can highlight matched text. Next for me to figure out is how to get those tags where matched text is in. All of the HTML text i'm reading and higlighting is between some tags, and now i need to figure out how to get the text until the > on the beggining side, and the < on the end side.
    I'm thinking, and thinking, and doing some more thinking, and nope, i still don't have the answer.

    To make it a bit more visual here's the "pseudo" code

    PHP Code:
    $match "bit of text";

    $whole_text "<h1>This is the whole text title<h1><p>In which i have this bit of text i want to take out of the text. That bit of text is my keyword, blah blah</p>..";

    if 
    $match == $whole_text {
    //get the whole text after the > and before the < of p opening and the ending //tags
    }

    //output would be
    ""Your matched text was found in this paragraph
    >In which i have this bit of text i want to take out of the textThat bit of text is my keywordblah blah<
    ""Thank you for using our services :)! 
    Any ideas?!

  • #2
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Ugh.. Changing the idea on getting certain paragraphs into array. Something like this
    Code:
    <h1>Title</h1>
    <p>Description</p>
    
    <h1>Title1</h1>
    <p>Description1</p>
    
    <h1>Title2</h1>
    <p>Description2</p>
    And with PHP get them into array

    Code:
    array ([0] => <h1>Title</h1>,
    [1] => <p>Description</p>,
    [2] => <h1>Title1</h1>,
    .
    .
    .


  •  

    Posting Permissions

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