JavaScript/RegExp replace portion of string
I have a string something like:

    foo title:2012-01-01 bar

Where I need to get the 'title:2012-01-01' and replace the date part '2012-01-01' to a special format. I just am not good at RegExp and currently have:

    'foo from:2012-01-01 bar'.replace(/from:([a-z0-9-]+)/i, function() {
        console.log(arguments);
        return 'replaced';
    })

and that returns

    foo replaced bar 

which is a start but not exactly correct. I need the 'from:' not to be replaced, just the '2012-01-01' be replaced. Tried using (?:from:) but that didn't stop it from replacing 'from:'. Also, I need to take into account that there may be a space between 'from:' and '2012-01-01' so it needs to match this also:

    foo title: 2012-01-01 bar
JavaScript/RegExp replace portion of string
===

I have a string something like:

    foo title:2012-01-01 bar

Where I need to get the 'title:2012-01-01' and replace the date part '2012-01-01' to a special format. I just am not good at RegExp and currently have:

    'foo from:2012-01-01 bar'.replace(/from:([a-z0-9-]+)/i, function() {
        console.log(arguments);
        return 'replaced';
    })

and that returns

    foo replaced bar 

which is a start but not exactly correct. I need the 'from:' not to be replaced, just the '2012-01-01' be replaced. Tried using (?:from:) but that didn't stop it from replacing 'from:'. Also, I need to take into account that there may be a space between 'from:' and '2012-01-01' so it needs to match this also:

    foo title: 2012-01-01 bar