I want to replace whole word in php. I found a code from the link below PHP string replace match whole word
I took code sample below from the above link.
$text = preg_replace('/\bHello\b/', 'NEW', $text);
but it is not working for me. I have a string like
3 OR ( 2 AND CreatedDate = LAST_N_DAYS:2 ) OR 4
After replace 2 using above code it becomes
3 OR ( Name = 'LAST WEEK' AND CreatedDate = LAST_N_DAYS:Name = 'LAST WEEK' ) OR 4.
2 is replace for "LAST_N_DAYS:2" string also. I want to replace only 2 alone. If it is with any word it should not be replaced.