in reply to Regular expression question

But your current regex only matches everything between [table] and [/table] if that 'everything' does not contain a '['....which, in your example, it does.