Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 177
Location: GA
Trades: 0
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
 
 
Register now for full access!
Old 06-02-2005, 03:42 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
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 '#'.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 06-03-2005, 05:33 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

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, 06:59 AM
HitRaj47's Avatar
Extreme Talker

Posts: 177
Location: GA
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.15872 seconds with 11 queries