Skip to content

Commit f4f0c34

Browse files
authored
Streamline validation of Regex (#650)
1 parent fa4d2d3 commit f4f0c34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JsonSchema/Constraints/FormatConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected function validateDateTime($datetime, $format)
197197

198198
protected function validateRegex($regex)
199199
{
200-
return false !== @preg_match('/' . $regex . '/u', '');
200+
return false !== @preg_match('#' . str_replace('#', '\\#', $regex) . '#u', '');
201201
}
202202

203203
protected function validateColor($color)

0 commit comments

Comments
 (0)