Make sure to escape - in the character class
Get rid of some deprecation warnings