lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Are you aware that the example you gave (replace() in _javascript_) also
cannot be used on user-provided strings without escaping hassle?

(I could not resist...)

Not true, at least as far as I tested ( V8 runtime ). _javascript_ differs between Strings* and RegExp objects where the literals of the second are written with the /bla/ syntax. When the first parameter of replace is a String*, replace treats it literally as well as the replacement string. I tested a lot with % . $ signs etc. it works all literally out of the box.

* Actually _javascript_ further differs between String objects and String natives, but thats a different, ugly story.