...

View Full Version : Getting a larger piece of matched text



matak
06-05-2007, 08:18 PM
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


$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 text. That bit of text is my keyword, blah blah<
""Thank you for using our services :)!

Any ideas?!

matak
06-06-2007, 02:04 PM
Ugh.. Changing the idea on getting certain paragraphs into array. Something like this


<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


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum