Regular expression for preg_replace

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
tuxsar
Forum Newbie
Posts: 3
Joined: Sun Apr 17, 2011 11:50 am

Regular expression for preg_replace

Post 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".
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Regular expression for preg_replace

Post by McInfo »

What is the relationship? Can you give more examples?
tuxsar
Forum Newbie
Posts: 3
Joined: Sun Apr 17, 2011 11:50 am

Re: Regular expression for preg_replace

Post by tuxsar »

Thank You.

Find "," and remove the string upto "," and replace remaining part.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Regular expression for preg_replace

Post 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 ..."?
Post Reply