Re: [PHP] Really simple regex

2005-06-09 Thread Jochem Maas
... $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; ... Thanks, that did it. I did not know about the +. And what is the 'sim' its not one thing but 3 things, everything that comes after a regexp closing marker (but inside the string) is

Re: [PHP] Really simple regex

2005-06-09 Thread Dotan Cohen
On 6/8/05, John Nichel [EMAIL PROTECTED] wrote: preg_replace ( /x+/, x, $string ); preg_replace ( /x{1,}/, x, $string ); But those will also change a letter 'x' in a word, so you'll probably need to tinker with that part too. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675

[PHP] Really simple regex

2005-06-08 Thread Dotan Cohen
Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x

Re: [PHP] Really simple regex

2005-06-08 Thread Rory Browne
preg_replace(/x+/, x, $string); should do it. Having that said, regex generally comes back and bites me in the ass, so... On 6/8/05, Dotan Cohen [EMAIL PROTECTED] wrote: Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to

Re: [PHP] Really simple regex

2005-06-08 Thread Matthew Weier O'Phinney
* Rory Browne [EMAIL PROTECTED] : preg_replace(/x+/, x, $string); should do it. Having that said, regex generally comes back and bites me in the ass, so... That one won't -- that's spot on. On 6/8/05, Dotan Cohen [EMAIL PROTECTED] wrote: Now, I know that this is easy, but I am

Re: [PHP] Really simple regex

2005-06-08 Thread Dotan Cohen
On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know that this is easy, but I am embarassed to say that I can't find a regex

Re: [PHP] Really simple regex

2005-06-08 Thread Jochem Maas
Dotan Cohen wrote: On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know that this is easy, but I am embarassed to say that I can't

Re: [PHP] Really simple regex

2005-06-08 Thread Dotan Cohen
On 6/8/05, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know

Re: [PHP] Really simple regex

2005-06-08 Thread John Nichel
Dotan Cohen wrote: Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string);