Re: Regilar expressions problem
| From: | Oliver Beddows | Date: | Sat, 13 Apr 2002 01:29:25 +0000 |
| Subject: | Re: Regilar expressions problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92844@lists.php.net to get a copy of this message | ||
On Saturday 13 April 2002 2:13 am, you wrote:
> I have an interactive website, with forums programmed by me. They have
> smilies, and I'm trying to make a way for users to be able to type smilies
> without them changing to images if they want. I'm trying to make it so if
> they type "NOSMILE:)" it will remove the NOSMILE and not display the
> smiley. I use "(NOSMILE){0}:)". The smiliey still displays if it has
> NOSMILE in front of it. Any ideas?
Hi,
I think this should work...
<?php
$text = 'NOSMILE:)';
if( preg_match('/(NOSMILE){1}(:\)){1}/', $text) )
{
echo('NOSMILE:) detected in text');
}
?>
Regards,
Oliver