...
$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
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
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
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
* 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
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
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
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
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);
9 matches
Mail list logo