Using preg_replace to replace all occurrences in php

Posted by Greg-J on Stack Overflow See other posts from Stack Overflow or by Greg-J
Published on 2011-01-10T03:24:00Z Indexed on 2011/01/10 3:54 UTC
Read the original article Hit count: 237

Filed under:
|
|

Regex is absolutely my weak point and this one has me completely stumped. I am building a fairly basic search functionality and I need to be able to alter my user input based on the following pattern:

Subject:

%22first set%22 %22second set%22-drupal -wordpress

Desired output:

+"first set" +"second set" -drupal -wordpress

I wish I could be more help as I normally like to at least post the solution I have so far, but on this one I'm at a loss.

Any help is appreciated. Thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about regex