I normally am a person who uses regular expressions all over the place (it is my job after all) but in this case I would highly recommend not doing it as it is a much slower option. Instead I would use the following
JScript code:
function startsWithToken(orig)
{
return (orig.charAt(0) == "$" && orig.charAt(1) == "$");
}
function endsWithToken(orig)
{
var len = orig.length;
return (orig.charAt(len-2) == "$" && orig.charAt(len-1) == "$");
}
I am not sure if a single character string is equivalent to a character, that is why I didn't use "===".