quote:
Originally posted by CookieRevised
? What?!?
will turn into:
..? What..?!..?
with that reg expression.... Maybe something to take into account that the question mark must be proceeded with text and at least 1 space should be after it before it is replaced?
No it won't. I assume you're talking about this one:
code:
stringObj.replace(/\?$/, "..?");
Because it is not global, only one occurrence will be replaced, and since there is the $ at the end of it, only the last one. "? What?!?" turns into "? What?!..?".