regex - Replacing a string inside a string in PHP -


I have a string in my application that users can send via a form, and they are optionally with replacement They can also replace the words in that string they also specify, for example, if one of my users has entered this string:

  I am a user string and I need to be parse is.  

and and should be replaced with foo , which should result in a string:

  I A user string foo requires me to be parsed. I  

I need to change the position of any kind, change what they want to change, replace it with the word and then Tie together.

Can someone write it above or at least provide an algorithm? My PHP skills are not really at work: (

Thanks.):

  preg_replace ('/ \ band \ b / i', 'foo', $ subject);  

will get all the events of and where it has its own words and replace it with foo \ b < / Code> ensures that there is a word limit before and after and .


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -