Re: Really simple regex

From: Date: Thu, 09 Jun 2005 10:48:39 +0000
Subject: Re: Really simple regex
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-216697@lists.php.net to get a copy of this message
...
$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

« previous php.general (#216697) next »