Page 1 of 1

Regular expression for preg_replace

Posted: Sun Apr 17, 2011 11:54 am
by tuxsar
Can you help me please what is the regular expression pattern for this string change in preg_replace?

from "On the day, he is playing" to "he is good to play".

Re: Regular expression for preg_replace

Posted: Sun Apr 17, 2011 12:06 pm
by McInfo
What is the relationship? Can you give more examples?

Re: Regular expression for preg_replace

Posted: Sun Apr 17, 2011 12:16 pm
by tuxsar
Thank You.

Find "," and remove the string upto "," and replace remaining part.

Re: Regular expression for preg_replace

Posted: Mon Apr 18, 2011 3:57 pm
by McInfo
If you remove "On the day, " and replace what is left, it is the same as replacing the entire string.

How does "he is playing" become "he is good to play"? Do you have a list of words or phrases and their replacements? Do words in the form "...ing" get replaced with "good to ..."?