| 
	
 | 
 Posted by robert on 04/25/06 19:39 
| preg_replace(/u=/(\d+), 'user='.$user_array["$1"], $buffer) 
| 
| where $1 is back reference integer found in the search.  Does that 
| clear things up?  Thanks for the help! 
 
preg_replace doesn't work that way. what you could do though, is enumerate  
your user array and replace from there. 
 
$users[23] = 10242; 
foreach ($users as $systemA => $systemB) 
{ 
  preg_replace('/u=([\s"\'])' . $systemA . '\\1/', 'user=' . $systemB,  
$buffer); 
} 
 
i haven't checked the accuracy of the expression but, i think you get the  
idea...based on your criteria, even if preg_replace could do what you hint  
at in your example, you'd be setting systemA user id's to blank where there  
is no corresponding systemB user match...unless that's a desirable  
side-effect. the above just wants systemA to either be surrounded by a  
space, quote, or tic on either side of the value. however you fix this, the  
above will only be replacing as many users as needed...your 15% or so. 
 
hth, 
 
me
 
  
Navigation:
[Reply to this message] 
 |