Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] String.replace and arrays
- From: junado at junado.com (Julien Nadeau)
- Subject: [Javascript] String.replace and arrays
- Date: Fri Sep 23 18:14:13 2005
Good evening, I'm rather puzzled by something I've encountered while playing with the string.replace() regex function in JavaScript. I have a string that contains text like this: var string = "this is some text [s]mouth.gif[/s] and some more text [s]tongue.gif[/s]"; Where "[s]mouth.gif[/s]" and "[s]tongue.gif[/s]" refers to smiley images. I'm trying to replace theses with their corresponding ASCII, such as ":D" and ":P". Using string.replace(), I got this regular expression that spot the [s] tags and parse the content. var parsedString = string.replace(/\[s\]([a-zA-Z0-9_\.]+)+\[\/s\]/gi, "$1"); 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. I've tried a few, but yet unsuccesful, solutions. Anyone here has an idea on how to make this work? Julien Nadeau junado@xxxxxxxxxx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.LaTech.edu/pipermail/javascript/attachments/20050923/0eb4b523/attachment.html
- Follow-Ups:
- [Javascript] String.replace and arrays
- From: Troy III Ajnej
- [Javascript] String.replace and arrays
- References:
- [Javascript] Permision Denied error - reg
- From: Jai Sankar N
- [Javascript] Permision Denied error - reg
- From: Flavio Gomes
- [Javascript] Permision Denied error - reg
- Prev by Date: [Javascript] Permision Denied error - reg
- Next by Date: [Javascript] String.replace and arrays
- Previous by thread: [Javascript] Permision Denied error - reg
- Next by thread: [Javascript] String.replace and arrays
- Index(es):