php preg_replace regex to replace function type string with its parameters -


i've text example.

a quick brown fox sance("jumps") on lazy ok("good") dog. 

i want remove sance() above string inside text. output like

a quick brown fox "jumps" on lazy ok("good") dog.

i tried many regex remove sance() have no luck. of time replaces other ok("good") not acceptable.

can plz me?

try one:

$string = 'a quick brown fox sance("jumps") on lazy ok("good") dog.';  echo preg_replace('/sance\((.*?)\)/', '$1', $string); 

output

a quick brown fox "jumps" on lazy ok("good") dog. 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -