[PHP] Re: Regular Expression Problem and PHP 4 (urgent)

2001-08-15 Thread Ross Nielsen

Actually I didn't pose my question correctly.
I also needed to grep out the Link for use in JS during the process.
I wrapped this in a class file and here is the entry that I ended up with.
Thanks for the assist though...
==
function getPL($plric)
  {
//variable set to add at the end of the RIC if it's a stock not a page
   $temp = B2;
//find out if it's a stock by query for the period in the RIC
   if (eregi(\., $plric))
   {
//add B2 if it's a stock
$plric = $plric + $temp;
   }
//the data comes out of the server pipe delimited
   $pages = split(\|,`/mdsweb/cgi-bin/Snap_Pages -s 000.000.000.00 -p
34927 -r $plric`);

   $a=0;
   while ($pages[$a] != )
   {
$pages[$a] = htmlentities($pages[$a]);
//replace spaces with nbsp;
$pages[$a] = str_replace( , nbsp;, $pages[$a]);
//find the left angle brackets
$a1 = spliti(lt;, $pages[$a]);
$b=0;
while ($a1[$b] != )
{
//if the resulting data has a right angle bracket
 if (eregi(gt, $a1[$b]))
 {
  $a2 = spliti(gt;, $a1[$b]);
  if (eregi(\., $a2[0]))
  {
   echo a class='small'
href='http://server/php/QST/PageTest.php?plric=;;
//this would be the raw RIC
   echo $a2[0],$tag;
//put back the left angle bracket in the link
   echo 'lt;;
   echo $a2[0];
//put back the right angle bracket in the link
   echo gt;/a;
   $c=1;
   //echo the link itself
while ($a2[$c])
   {
echo $a2[$c];
$c++;
   }
  }
  else
  {
   echo a class='small'
href='http://server/php/QST/PageTest.php?plric=;;
//this would be a Page request not a RIC
   echo $a2[0];
   echo ';
   echo $a2[0];
   echo /a;
   $c=1;
   while ($a2[$c])
   {
echo $a2[$c];
$c++;
   }
  }
 }
 else
 {
  echo $a1[$b];
 }
$b++;
}
   echo br;
   $a++;
   }
  }


Richard Lynch [EMAIL PROTECTED] wrote in message
00a001c1253f$53fad780$6401a8c0@Lynchux100">news:00a001c1253f$53fad780$6401a8c0@Lynchux100...
  blah blah blah blah blah Link blah blah blah blah Link
 
  I think I need to use eregi_replace to make the line look like this:
  blah blah blah blah blah a href='#'Link/a blah blah blah blah a
  href='#'Link/a

 Depending on how accurately you have stated the problem, this may work:

 $text = 'blah blah blah blah blah Link blah blah blah blah Link';
 $text = str_replace('', a href='#'XX, $text);
 $text = str_replace('', /a, $text);
 $text = str_replace('XX', '', $text);

 --
 WARNING [EMAIL PROTECTED] address is an endangered species -- Use
 [EMAIL PROTECTED]
 Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
 Volunteer a little time: http://chatmusic.com/volunteer.htm





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Regular Expression Problem and PHP 4 (urgent)

2001-08-14 Thread Richard Lynch

 blah blah blah blah blah Link blah blah blah blah Link

 I think I need to use eregi_replace to make the line look like this:
 blah blah blah blah blah a href='#'Link/a blah blah blah blah a
 href='#'Link/a

Depending on how accurately you have stated the problem, this may work:

$text = 'blah blah blah blah blah Link blah blah blah blah Link';
$text = str_replace('', a href='#'XX, $text);
$text = str_replace('', /a, $text);
$text = str_replace('XX', '', $text);

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]