That script sample is specific to the given filename format example. It gives some implementations ideas but obviously if the used regex gives different results, the script must change too.
With your example, Title (Author, 2nd Ed, 2000), I think a better approach would be to split the text inside the parenthesis, using the javascript split function (comma as delimiter), and then extract each individual item from the result array, taking into account the length of the array to infer the presence or not of a given item.