<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">My parsed string does work. It does replace the [s]mouth.gif[/s] by mouth.gif. What I am trying to do though if to have [s]mouth.gif[/s] replaced by ":D", [s]tongue.gif[/s] replaced by ":P" and so on for the 20 or so smileys. So I'm trying to figure out a way to have the .replace() return the value from an array or something similar, but nothing has worked so far, and I'm trying to stay away from having to replace them all by hand.<BR><DIV> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">Julien Nadeau</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><A href="mailto:junado@junado.com">junado@junado.com</A></FONT></P>  </DIV><BR><DIV><DIV>Le 05-09-23 à 21:31, Troy III Ajnej a écrit :</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="background-color:"><P><BR><BR></P><P><BR>Have you tried to alert your 'parsedString' to see what it returns,</P><P>It is posible that your replace string is escaping the <FONT color="#cc0033">:</FONT> character ?!<BR><BR></P> <DIV><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"><HR color="#a0c6e5" size="1"> From: <I>Julien Nadeau &lt;<A href="mailto:junado@junado.com">junado@junado.com</A>&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;<A href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</A>&gt;</I><BR>To: <I>"[JavaScript List]" &lt;<A href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</A>&gt;</I><BR>Subject: <I>[Javascript] String.replace and arrays</I><BR>Date: <I>Fri, 23 Sep 2005 19:14:01 -0400</I><BR><BR>Good evening,</FONT></DIV><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><DIV><BR class="khtml-block-placeholder"></DIV>I'm rather puzzled by something I've encountered while playing with the string.replace() regex function in JavaScript. <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>I have a string that contains text like this:</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>var string = "this is some text [s]mouth.gif[/s] and some more text [s]tongue.gif[/s]";</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>Where "[s]mouth.gif[/s]" and "[s]tongue.gif[/s]" refers to smiley images.</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>I'm trying to replace theses with their corresponding ASCII, such as ":D" and ":P".</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>Using string.replace(), I got this regular expression that spot the [s] tags and parse the content.</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>var parsedString = string.replace(/\[s\]([a-zA-Z0-9_\.]+)+\[\/s\]/gi, "$1");</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>However, I'm trying to get that $1 value and use it as an array index where I can store all corresponding ASCII values relative to filenames.</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>I've tried a few, but yet unsuccesful, solutions.</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>Anyone here has an idea on how to make this work?<BR> <DIV><DIV style="min-height: 14px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT style="FONT: 12px Helvetica" face="Helvetica" size="3">Julien Nadeau</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT style="FONT: 12px Helvetica" face="Helvetica" size="3"><A href="mailto:junado@junado.com">junado@junado.com</A></FONT></DIV></DIV><BR></DIV><BR><P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;<A href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A><BR>&gt;<A href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A><BR> </P><DIV><BR class="khtml-block-placeholder"></DIV></BLOCKQUOTE></FONT></DIV><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif"><BR clear="all"><HR>Express yourself instantly with MSN Messenger! <A href="http://g.msn.com/8HMAEN/2740??PS=47575" target="_top">MSN Messenger</A> Download today it's FREE! </FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Javascript mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A></DIV> <BR class="Apple-interchange-newline"></BLOCKQUOTE></DIV><BR></BODY></HTML>