i need to declate a pattern for each string i want to match. if there way i can match right or left and replace according to that ?
if you found left replace with right, if you found right replace with left acrording to the order in the pattern
this code doesn't work.PHP Code:$pattern = array('/[^-{]\bleft\b/','/[^-{]\bright\b/');
$replace = array('right','left');
$subject = 'body {left: 24px;} p {right: 24px;}';
$subject = preg_replace($pattern, $replace, $subject);
echo $subject;



Reply With Quote

Bookmarks