Q:

Getting the words after a search term using regular expression in Javascript

I am trying to find the javascript regex to return the string after the word 'the'.
Original string:
"The great expedition"

I want to return:
"great expedition"

The closest I have got is:
var matched = "The great expedition".match(/^the \b(.*)$/i);

matched contains 2 strings in it:
["The great expedition", "great expedition"]

Where am I going wrong?
Appreciate any help
Cheers

A:

[EDIT by r3mus]    
function stripThe(word)
{
    var match = word.match(/^the \b(.*)$/i);
    if (match.length > 1) {
        return match[1];
    }else{
        return word;
    }
}

Or, simpler, if you just want to strip it:
function stripThe(word)
{
    return word.replace(/^the\s*/i, "");
}

This way you only test once for the expression.

