On Jan 13, Troy May said:

>I'm having a problem with a bulletin board I'm setting up.  All the smilies
>work except for one, the wink one.  which be called when you type in ";)".
>It won't display the graphic.  All the others are fine so I know's it not a
>config or directory problem.  Here's the regex that looks for it:
>
>$message =~ s/(\W|\A)\;\-\)/$1\<img src=$cfg{'nonCgiPath'}\/wink.gif\>/g;

You have it written to match ;-) not ;).  Remove the \- from the regex.

And the character ; - < > are not special to regexes.  And if you don't
want to write \/ in a regex to have a / in it, you can use a different
regex delimiter:

  $message =~ s{(?<!\w);\)}{<img src="$cfg{nonCgiPath}/wink.gif">}g;

I also changed your (\W|\A) to (?<!\w) which matches the same way, but
doesn't actually CONSUME what it matched -- that's why I don't have $1 on
the right-hand side.

(?<!\w) means "not preceded by a word character", which is the same as
your (\W|\A) which means "non-word character or beginning of string".

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to