this JS code goes towards a plugin for my forum.

the user-code for the smileys is supplied from a <span>user-code</span> or dictionary object as:


^while this is user-code, a GUI replaces the textarea containing this, so the user doesn't get to see this code.

as for the code that executes the user-code on a post:

function Tcll5850_BBC_CSmileys(post, data) {
    if (data) {
        $.each(eval("("+data+")"), function(smiley, url) {
            post = post.replace(new RegExp('\\b'+smiley+'\\b', 'g'), '&nbsp;<img src="'+url+'" />&nbsp;');
    return post

where 'data' is the user code...
why doesn't RegExp('\b'+smiley+'\b', 'g') work?? O.o

I want it to work in cases where:
- the first character in the post is the start of a smiley
- the smiley is in the middle of text (and is not merged such as "8)" in "func(8):" )
- the smiley is, of course, at the end of a line

none of these cases work with the code provided

how can I fix this??

Edited by Tcll

3 Years
Discussion Span
Last Post by Tcll

why I'm stammered about it not working...
I'm doing another project where I'm building an IDE in python using QRegExp()

the text sent through there udergoes a very similar (almost exact) method as what I'm doing here.
I'll admit I'm not a regex expert, but I do know alot about it... :/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.