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 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?
Hi,
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.
Bye.
\w
Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_].
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.