Please consider the following code:

`$('[name='+temp[i][0]+']').prev().addClass('form_error');`

where temp[i][0] is an array item holding the name of a form field which contains square brackets (as it represents a checkbox array), `name_of_field[]`.

In order for this to work I know I should escape the square brackets in the form field's name. However, since I'm a newbie to regular expressions, I can't seem to get it right. Could anyone provide me with the proper code? Many thanks.