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?
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.
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.