In article <01b201c13354$0ca601c0$0105050a@pony>,
 [EMAIL PROTECTED] (Stonix) wrote:

> ereg_replace( "{key}", "word", $a_string);
> 
> The web server will return following warnning msg:
> 
> Warning: Invalid content of \{\} in /var/www/html/scrip.php on line #

In regex, the curly braces are special characters used to define the number 
of repetitions to be matched, either as an exact number or as a range.

"a{2}" #"aa"
"abc(2,3}" #"abcabc" or "abcabcabc"
"abc{,2}" #"","abc", or "abcabc"

Are you trying to match the literal string "{key}"?  'Cuz if so, you might 
as well just use str_replace since you're not really in need of ereg_*'s 
special pattern matching.  If you're trying to match a special character 
with a regex, don't forget to either escape it or put it in a character 
class:

ereg_replace( "\{key\}", "word", $a_string); 
ereg_replace( "[{]key[}]", "word", $a_string);

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to