Skip to content

Commit

Permalink
Added negative lookahead on regex to stop match at first quotation ma…
Browse files Browse the repository at this point in the history
…rk so the match works inside an href link without whitespace around it
  • Loading branch information
zakhenry committed Jul 29, 2015
1 parent c72bf6c commit 588ba43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/tests/integration/UserTest.php
Expand Up @@ -279,8 +279,8 @@ public function testResetPasswordMail()
// Extract the token from the message source
$msg = $this->getLastMessage();
$source = $this->getMessageSource($msg->id);
preg_match_all('!https?://\S+!', $source, $matches);
$tokenUrl = $matches[0][0];
preg_match_all('/https?:\/\/\S(?:(?![\'"]).)*/', $source, $matches);
$tokenUrl = trim($matches[0][0]);
$parsed = parse_url($tokenUrl);
$token = str_replace('passwordResetToken=', '', $parsed['query']);

Expand Down

0 comments on commit 588ba43

Please sign in to comment.