Re: Really simple regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




...

$string="I have xxxxxxxx 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 treated as a regexp modifier,
in this case the modifiers are:

modifer - meaning
------------------------------------
s       - PCRE_DOTALL
i       - PCRE_CASELESS
m       - PCRE_MULTILINE

read more here: http://nl3.php.net/manual/en/reference.pcre.pattern.modifiers.php

...




Thank you for that link! I have so much to learn (there is so much to learn).

well the guys that wrote the page deserve the credit!, and I know how you feel
about the learning thing - everytime you think you have a reasonable understanding
of something, another door opens and you realise you don't know 'jack'! :-)

good luck

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux