Hi there, I have a script that uses a RegEx to get data from a TextArea.
Here's a bit of the code I currently have:
$str = nl2br(rtrim($_POST[text]));
$num = 0;
$i = 0;
while ($i < 200)
{
preg_match_all("/Address:.[^\\n]*/i", $str, $matches);
foreach ($matches as $val) {
$txtol = $val[$num];
echo $txtol;
}
$i++;
$num++;
}
I was just wondering if anyone knew how I could echo what was two lines above the "Address:" line?
Eg. If someone put this in the textarea:
BlahBlah
Hello
Blah
Address: moretext
Stuff
How could I echo "Hello" without knowing what was put in the textbox?