private function parse()
 {
     $suffixes = implode("\\.*|", $this->suffixes) . "\\.*";
     // each suffix gets a "\.*" behind it.
     $prefixes = implode(' |', $this->prefixes) . ' ';
     // each prefix gets a " " behind it.
     // The regex use is a bit tricky.  *Everything* matched by the regex will be replaced,
     //	but you can select a particular parenthesized submatch to be returned.
     //	Also, note that each regex requres that the preceding ones have been run, and matches chopped out.
     $nicknamesRegex = "/ ('|\"|\\(\"*'*)(.+?)('|\"|\"*'*\\)) /";
     // names that starts or end w/ an apostrophe break this
     $suffixRegex = "/,* *({$suffixes})\$/";
     $lastRegex = "/(?!^)\\b([^ ]+ y |{$prefixes})*[^ ]+\$/";
     $leadingInitRegex = "/^(.\\.*)(?= \\p{L}{2})/";
     // note the lookahead, which isn't returned or replaced
     $firstRegex = '/^[^ ]+/';
     //
     // get nickname, if there is one
     $this->nicknames = $this->name->chopWithRegex($nicknamesRegex, 2);
     // get suffix, if there is one
     $this->suffix = $this->name->chopWithRegex($suffixRegex, 1);
     // flip the before-comma and after-comma parts of the name
     $this->name->flip(',');
     // get the last name
     $this->last = $this->name->chopWithRegex($lastRegex, 0);
     if (!$this->last) {
         throw new Exception("Couldn't find a last name in '{$this->name->getStr()}'.");
     }
     // get the first initial, if there is one
     $this->leadingInit = $this->name->chopWithRegex($leadingInitRegex, 1);
     // get the first name
     $this->first = $this->name->chopWithRegex($firstRegex, 0);
     if (!$this->first) {
         throw new Exception("Couldn't find a first name in '{$this->name->getStr()}'");
     }
     // if anything's left, that's the middle name
     $this->middle = $this->name->getStr();
     return true;
 }
 public function testFlip()
 {
     $this->object->setStr("O'Malley, Björn");
     $this->object->flip(',');
     $this->assertEquals("Björn O'Malley", $this->object->getStr());
 }