replaced preg_split() with preg_match() and changed the regex on the saveDoc() method