What does (^| ) and ( |$) mean?

Forgive my n00b question. I am on page 117 (Removing a Class) of the Simply Javascript pdf and I was wondering what does the syntax (^| ) and ( |$) mean?

Core.removeClass = function(target, theClass)
{
var pattern = new RegExp("(^| )" + theClass + "( |$)");
target.className = target.className.replace(pattern, "$1");
target.className = target.className.replace(/ $/, "");
};

Many thanks.

(^| ) means start of field or space
( |$) means space or end of field

You could also use \b instead of each which means boundary