Jump to content

chrismead

Registered Users - Approved
  • Posts

    2
  • Joined

Everything posted by chrismead

  1. I've run into a snag with a template where users are allowed to enter their own comment line. Some people requested Smilies in the form of ":)" which I used a snippet of code to replace with ☺: return Trim(Field("Comment").replace(":)","☺"); Someone just asked for a line of Smilies ":) :) :)" and that code returned "☺ :) :)". No problem, I'm thinking, I'll just make it a global replace with /g: return Trim(Field("Comment").replace(/:)/g,'☺'); Unfortunately, the close parenthesis refuses to register as a character in this format- an error message is returned when I try to validate: "Comment Rule, line 6: SyntaxError: unmatched ) in regular expression" Using .replace(":)"/g,'☺') doesn't work because the expressions are mixed (I'm not sure if that's the right terminology). Using .replace(/:()/g,'☺') generates valid code, but returns ☺)☺)☺)☺) (I did not expect it to give the right results, but it shows some of the internal process being applied). I'm not at the end of my rope, but some of the solutions I'm thinking of are getting really complicated. Does anyone have suggestions?
×
×
  • Create New...