Skip to content
Advertisement

Tag: preg-replace

Remove double quote in json_encode()

I want remove double quote in my json_encode, that is my code: My result is that: I want to remove double quote of “id_posiciones” and “device_version” too. How can I do for the result is that: Answer If you add an underscore to your regex at the end it will do it. I assume that’s what that preg_replace is for

Optimizing regex for sentence sanitizer

This is a sentence sanitizer. This is the test sentence: hello [[[[[[]]]]]] friend…..? how are you [}}}}}} It should return: hello friend…..? how are you But instead it is returning: hello friend. .. .. ? how are you. So there are 2 problems and I can’t find a solution around them: the set of periods are being separated into “..

PHP preg replace only allow numbers

How can I modify this existing preg_replace to only allow numbers? Answer I think you’re saying you want to remove all non-numeric characters. If so, D means “anything that isn’t a digit”:

Advertisement