rejetto forum

replace command

kaler · 5 · 3208

0 Members and 1 Guest are viewing this topic.

Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
hello...

when i save a .txt file, then i can say that some codes must be replaced...
so follow code:
Code: [Select]
{.replace
|:)|<img src="/chat/smileys/smiley.gif" alt=""/>
.}
now i want make it, that every smile code will be replaced by the smiley.gif
i thought that i must put this:
Code: [Select]
{.replace
|{.!:).},{.!:-).}|<img src="/chat/smileys/smiley.gif" alt=""/>
.}

But it doesent work...
what must i write so that : ) and :-) will be the 'smiley.gif'???

Thank you
« Last Edit: August 29, 2009, 07:43:25 PM by kaler »


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
I am not sure but I do not think you can stack replacements.... You could just do a new line for the new input method. Redudant I know, but it'll do the job.


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
ok thank you...

can you (please) answerd also my other question??? thank you


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the other syntax you tried cannot work.
let's say you have many different smiles to replace,
since they share a lot of the text
<img src="/chat/smileys/smiley.gif" alt=""/>
where only the smiley part changes, because i guess you keep all the images in the same folder!
i would use a short for the first part (before "smiley"), and another short for the second part.
let's say £$% and %$£
(we must hope these are not already present in the text, but it's unlikely to be)

only in the end i would replace the shorts with what they finally should be.

then, it would be something like this

{.replace|:)|£$%smiley%$£|:-)|£$%smiley%$£|;)|£$%blink%$£|;-)|£$%blink%$£|:D|£$%grin%$£|:-D|£$%grin%$£|£$%|<img src="/chat/smileys/|%$£|.gif" alt=""/>|
here goes your text, and it would be nice it to be contained in a variable, and referenced by the 'var' parameter
/replace.}


replace can replace many things in the same text, and it goes from left to right. so the shorts are replaced as last thing.

this problem lead me to add the parameter 'replace' to macro {.regexp.}
will be available in next version


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
i try to understand... thank you for help...