As seen from the question the pattern to be matched is
1. Individual page number like 9,31
2. Page range like 1-6,22-28
Individual page numbers and Page range are separated by , in any order.
For this purpose the following regular expression can be used
^\s*((\d+|\d+\s*-\s*\d+)\s*,\s*)*(\d+|\d+\s*-\s*\d+)\s*$
The first part of expression
^\s*((\d+|\d+\s*-\s*\d+)\s*,\s*)*
matches either a single page number or a page range (- surrounded by zero or more spaces) followed by a , (surrounded by zero or more spaces)
then the second part of expression ensures that string ends with either single page number or a page range with out a comma at the end
(\d+|\d+\s*-\s*\d+)\s*$
This can be tested online at
http://regexhero.net/tester/[
^]