## Perl - 53 Bytes ##

<!-- language-all: lang-perl -->

    #!perl -p054
    $\+=grep+(lc$')!~(T^lc$_%2),$&..$'*/\d+ ?-/;/$/}{

Amended to pass the new test case.

---

**Original**

## Perl - 36 Bytes ##

    #!perl -p054
    $\+=/\d+ ?-/*($'-$&>>/o|e/i)+1}{

Counting the shebang as 4, input is taken from stdin.

---

**Sample Usage**

    $ echo pg. 546: 17-19, 22, 26, pg. 548: 35-67 odd, 79, 80-86 even | perl math-problems.pl
    27

    $ echo pg. 34: 1 | perl math-problems.pl
    1

    $ echo PG. 565: 2-5,PG.345:7 | perl math-problems.pl
    5

    $ echo pg. 343: 5,8,13 - 56 even,pg. 345: 34 - 78,80 | perl math-problems.pl
    70

---

**Caveats**

For even/odd ranges, it is expected that at least one of the endpoints matches the parity of the range. For example, `11-19 odd`, `11-20 odd`, and `10-19 odd` will all be correctly counted as 5, but `10-20 odd` will be over-counted as 6.