Update parser.js

Switched to regular expressions