[PHP] ob_start callback preg_replace

2004-06-02 Thread John Kaspar
Can someone help me with preg_replace?
I want to convert all numbers either 8 or 9 digits in length, into a 
link.  Such that when it sees:

John Doe, 456890123, is a new employee.
It converts it to:
John Doe, a href='employee.html?id=456890123'456890123/a, is a new 
employee.

function callback($buffer) {
  // create id links
  return ???;
}
ob_start(callback);
Thanks much,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ob_start callback preg_replace

2004-06-02 Thread Marek Kilimajer
John Kaspar wrote:
Can someone help me with preg_replace?
I want to convert all numbers either 8 or 9 digits in length, into a 
link.  Such that when it sees:

John Doe, 456890123, is a new employee.
It converts it to:
John Doe, a href='employee.html?id=456890123'456890123/a, is a new 
employee.

function callback($buffer) {
  // create id links
  return ???;
}
ob_start(callback);
Thanks much,
John
return preg_replace('/([0-9]{8,9})/',
  'a href=employee.html?id=$1$1/a', $buffer);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php