Expression : replace()
Hi,
I am trying to get as much information as possible about the expression .replace() .
I looked the Ae expression documentation, forums, asked Adobe assitants, but never found official and complete informations about this expression. So If you have a link or informations yourself, feel free to let us all know in the comment, I'll actualise this post.
Note that I'm not a pro and English is not my first language, so if there are errors, tell me what to change.
Here are the informations I have already :
// g : search (g)lobally for the string
// i : search while been case (i)nsensitive
var a1 = [numerical or alphabetical value];
var a2 = [second numerical or alphabetical value];
...
var b = [numerical or alphabetical value inside ""];
text.sourceText.replace(/a1|a2/gi, b)
exemples :
text.sourceText.replace(/e/gi, 3)
// before : HELLO everyone
// after : H3LLO 3v3ryon3
______________
text.sourceText.replace(/e/, 3)
// before : HELLO everyone
// after : HELLO 3veryone
______________
text.sourceText.replace(/E|o/g, 1)
// before : HELLO everyone
// after : H1LLO every1ne
______________
text.sourceText.replace(/e/gi, 3).replace(/o/gi, "@")
// before : HELLO everyone
// after : H3LL@ 3v3ry@n3
- It seems to work only on Source text and not numeric values. Even if it can replace numbers.
- When not using "g" it only works on the first character found, even if you search for severals characters with "|".
- $ seems to be an important. It displays "[Helper Object]".
Thanks to :
Dan Ebberts (on Creative Cow)
Lloyd Alvarez (on Creative Cow)
