Reply
Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found
Old 06-02-2005, 04:14 PM Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found
HitRaj47's Avatar
Extreme Talker

Posts: 177
Location: GA
I'm getting the following error messages:

Quote:
Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found in C:\webserver\mkspace\includes\functions.php on line 9

Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found in C:\webserver\mkspace\includes\functions.php on line 11

Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found in C:\webserver\mkspace\includes\functions.php on line 12

Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found in C:\webserver\mkspace\includes\functions.php on line 13

Warning: preg_replace() [function.preg-replace]: No ending delimiter ';' found in C:\webserver\mkspace\includes\functions.php on line 15
The code it's referring to is:

PHP Code:
        preg_replace(':angry:''<img src="http://www.mkspace.com/mkspace/image/emoticons/angry.gif" alt="Angry" />'$txt);
        
preg_replace(':\'(''<img src="http://www.mkspace.com/mkspace/image/emoticons/crying.gif" alt=":\'(" />'$txt);
        
preg_replace(':lol:''<img src="http://www.mkspace.com/mkspace/images/emoticons/laughing.gif" alt=":lol:" />'$txt);
        
preg_replace(':(''<img src="http://www.mkspace.com/mkspace/images/emoticons/sad.gif" alt=":(" />'$txt);
        
preg_replace(':)''<img src="http://www.mkspace.com/mkspace/images/emoticons/smile.gif" alt=":)" />'$txt);
        
preg_replace(':P''<img src="http://www.mkspace.com/mkspace/images/emoticons/tongue.gif" alt=":P" />'$txt);
        
preg_replace(':huh:''<img src="http://www.mkspace.com/mkspace/images/emoticons/wassat.gif" alt="Huh?" />'$txt);
        
preg_replace(';)''<img src="http://www.mkspace.com/mkspace/images/emoticons/wink.gif" alt=";)" />'$txt); 
HitRaj47 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-02-2005, 04:42 PM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
You have to tell preg where you're regex is starting and ending, this is done by delimiters. Whatever your first character is, your last character has to be (making them the delimiters). So...

Code:
/:angry:/
/:\'\(/
/:lol:/
/:\(/
Etc will use '/' as a delimeter. Another common one is '#'.
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 06-03-2005, 06:33 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,120
Name: Mike
Location: Mataro, Spain
At least you call preg_replace() in a wrong way. This functions returns the modified text, so you must do
PHP Code:
$txt preg_replace(...); 
Next, you also must escape slashes, backslashes and round brackets:
PHP Code:
$txt preg_replace("/:\)/", ... , ...);
$txt preg_replace("/:\\/", ... , ...); 
Also it's recommended to use str_replace() in this case because you don't do anyithing special with your source string. But from another side you can benefit from using preg_replace in following way:
PHP Code:
$mathces = array(
   
'/:angry:/'
   
'/:\)/'
   
// whatever else
   
);
$replaces = array(
   
'<img ....>',
   
'<img ....>',
   
// more images
);
$txt preg_replace($matches$replaces$txt); 
Hope that helps.
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 06-03-2005, 07:59 AM
HitRaj47's Avatar
Extreme Talker

Posts: 177
Location: GA
thanks for your help guys, i've fixed it now
HitRaj47 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Warning: preg_replace() [function.preg-replace]: No ending delimiter ':' found
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11567 seconds with 12 queries