I have a string with the following format,
some_string%value1:value2:value3:%some_anather_string%value4:value5:value6:%
I need to remove%value1:value2:value3:% and %value4:value5:value6:% from the string,i mean i need to remove any string with the format of starting with % ending with :% and values seperated with :
Is this possible?
I try with str_replace(),But it work only we know the values.
Use can use this simple regex
echo $str = preg_replace("~%(.*?):%~","", $str);
Demonstration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With