This content has been marked as final. Show 5 replies
var newBleed = bleed.replace(/\W/gi, "");
Also, you seem to have some misconceptions about this function:
1. There are two different replace() functions, one for a String object and one for a RegExp object. Only the latter takes a RegExp as it's first parameter.
2. Neither function changes the variable you use it on, it just returns a new value.
Hi Try, thank you for adressing my ignorance once again :-)
I see now that the regexp could be made a lot simpler(!) I you were to look for exactly a whitespace in the beginning and a "dot" in the end of the string how would this pattern look like?
First of all a correction: my first point before was not accurate. There is in fact only one function and you can use it only for String objects. You can't apply a replace function to a RegExp.
About your question: that would actually be more complicated... but one way to do it is something like this:
var newBleed = RegExp.lastParen;
Thank you for another fine lesson in scripting. I can't wait to study your regex pattern :-)
Cheers from Denmark,