Skip to content

Commit

Permalink
Streamline validation of Regex (jsonrainbow#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-m-i-n authored Jan 8, 2021
1 parent fa4d2d3 commit f4f0c34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/FormatConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected function validateDateTime($datetime, $format)

protected function validateRegex($regex)
{
return false !== @preg_match('/' . $regex . '/u', '');
return false !== @preg_match('#' . str_replace('#', '\\#', $regex) . '#u', '');
}

protected function validateColor($color)
Expand Down

0 comments on commit f4f0c34

Please sign in to comment.