My text variable is
$text="518609136Buddha_flag-Copy-(Copy)1.jpg";
I want to replace the only ( ) with space like is
"518609136Buddha_flag-Copy- Copy 1.jpg"
I am use the
$text=preg_replace('/[^A-Za-z]+/', ' ', $text);
but this output is
518609136Buddha_flag-Copy- Copy 1 jpg
You can use str_replace
$text="518609136Buddha_flag-Copy-(Copy)1.jpg";
str_replace(array( '(', ')' ), '', $text);
您可以尝试:
$text=preg_replace('/[()]/g', ' ', $text);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.