Re: [PHP] regex for emoticon codes

2002-07-08 Thread John Legg

Hi Roger

Try this:

$str = sometext sometext [emoticon01] sometext [emoticon23] sometext;

$new_str = preg_replace(/\[emoticon(\d\d)\]/, /image/emot/\\1.gif,
$str);

print $new_str;

Seems to work?

Rgds

John

- Original Message -
From: Roger Thomas [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 08, 2002 11:41 AM
Subject: [PHP] regex for emoticon codes


 i have something like
 $str = sometext sometext [emoticon01] sometext [emoticon23] sometext;

 i would like to use regex to replace those codes into:
 sometext sometext /images/emot/01.gif sometext /images/emot/23.gif
sometext

 all numerics after the code emoticon consisted of exactly 2 digits; and
they
 are in the range from emoticon01 to emoticon30.

 i have spent the whole day starring at my crt and reading manpages plus
 examples. i achieved nothing but sore eyes.

 i would GREATLY-GREATLY appreciate if someone could gimme a code snippet
on how
 to this sorta thing.

 best rgds.
 roger



 __
 Do You Yahoo!?
 Sign up for SBC Yahoo! Dial - First Month Free
 http://sbc.yahoo.com

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




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




Re: [PHP] regex for emoticon codes

2002-07-08 Thread Roger Thomas

yeeaHAH ! great. Thanks John.
think i'll never regret joining the list.

--
roger


--- John Legg [EMAIL PROTECTED] wrote:
 Hi Roger
 
 Try this:
 
 $str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
 
 $new_str = preg_replace(/\[emoticon(\d\d)\]/, /image/emot/\\1.gif,
 $str);
 
 print $new_str;
 
 Seems to work?
 
 Rgds
 
 John
 
 - Original Message -
 From: Roger Thomas [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, July 08, 2002 11:41 AM
 Subject: [PHP] regex for emoticon codes
 
 
  i have something like
  $str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
 
  i would like to use regex to replace those codes into:
  sometext sometext /images/emot/01.gif sometext /images/emot/23.gif
 sometext
 
  all numerics after the code emoticon consisted of exactly 2 digits; and
 they
  are in the range from emoticon01 to emoticon30.
 
  i have spent the whole day starring at my crt and reading manpages plus
  examples. i achieved nothing but sore eyes.
 
  i would GREATLY-GREATLY appreciate if someone could gimme a code snippet
 on how
  to this sorta thing.
 
  best rgds.
  roger
 
 
 
  __
  Do You Yahoo!?
  Sign up for SBC Yahoo! Dial - First Month Free
  http://sbc.yahoo.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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