With the growing adoption of the ECMAScript 2018 standard, it makes sense to also consider the lookbehind approach:
const text = "One Test: ^Anotherword";
// Extracing words not preceded with ^:
console.log(text.match(/\b(?<!\^)\w+/g)); // => [ "One", "Test" ]
// Replacing words not preceded with ^ with some other text:
console.log(text.replace(/\b(?<!\^)\w+/g, '<SPAN>$&</SPAN>'));
// => <SPAN>One</SPAN> <SPAN>Test</SPAN>: ^Anotherword
The \b(?<!\^)\w+ regex matches one or more word chars (\w+) that have no word char (letter, digit or _) immediately on the left (achieved with a word boundary, \b) that have no ^ char immediately on the left (achieved with the negative lookbehind (?<!\^)). Note that ^ is a special regex metacharacter that needs to be escaped if one wants to match it as a literal caret char.
For older JavaScript environments, it is still necessary to use a workaround:
var text = "One Test: ^Anotherword";
// Extracing words not preceded with ^:
var regex = /(?:[^\w^]|^)(\w+)/g, result = [], m;
while (m = regex.exec(text)) {
result.push(m[1]);
}
console.log(result); // => [ "One", "Test" ]
// Replacing words not preceded with ^ with some other text:
var regex = /([^\w^]|^)(\w+)/g;
console.log(text.replace(regex, '$1<SPAN>$2</SPAN>'));
// => <SPAN>One</SPAN> <SPAN>Test</SPAN>: ^Anotherword
The extraction and replacement regexps differ in the amount of capturing groups, as when extracing, we only need one group, and when replacing we need both groups. If you decide to use a regex with two capturing groups for extraction, you would need to collect m[2] values.
Extraction pattern means
(?:[^\w^]|^) - a non-capturing group matching
[^\w^] - any char other than a word and ^ char
| - or
^ - start of string
(\w+) - Group 1: one or more word chars.