[jQuery] Error-Message: is not a function

[jQuery] Error-Message: is not a function


Hi,
I've been thinking the last two hours about this problem:
The following function is part of a form validation script. The
targeted selects contain a name attribute like "accomodation[1]" or
"accomodation[2]". I neet the number within the brackets. The alert-
function is just for testing and will be replaced later on by the
processing of catid.
I constantly get the errormessage "catid.replace is not a function"
pointing to the line containing the first .replace.
function checkacc() {
    var catid;
    var places;
    var err;
    err = 0;
    $("select[name^='accommodation']").each( function() {
            catid = $(this).attr("name").match(/\[.+\]/);
            catid = catid.replace(/\[/,"");
            catid = catid.replace(/\]/,'');
            alert(catid);
            err = 1;
        }
    );
    return err;
}
Can some one help me please?
And then I'm confused about the "this"-Syntax. I thougth that I can
use it like this: this.attr... but then I get an is-not-a-function-
error too. (By the way: $(catid) produces the same error).
Thanks,
Jan