wolf_22 — 2010-12-12T11:56:34-05:00 — #1
I have the following truncation expression and it's replacing everything when tripped--even anchor code.
trunc = trunc.replace(/\\w+$/, '');
What can I do to make it ignore the code that's used for anchor tags?
whisher — 2010-12-12T12:58:11-05:00 — #2
I'm not absolutely sure what you are asking for
but I'll have a try
var trunc = 'fffff#?ffffffff';
trunc = trunc.replace(/[a-z#]+$/, '');
// trunc == fffff#?
I hope this can help.
aussiejohn — 2010-12-12T18:01:31-05:00 — #3
Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_].
For example, /\w/ matches 'a' in "apple," '5' in "$5.28," and '3' in "3D."
What is it you're trying to do? Truncate white space from the end of a string?
If so, you'll probably want to use \s instead.