Skip to content

Commit fb9f6ec

Browse files
committed
refactor: add property for control code regex
Users could override the property.
1 parent 97be037 commit fb9f6ec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

system/Filters/InvalidChars.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class InvalidChars implements FilterInterface
3232
*/
3333
protected $source;
3434

35+
/**
36+
* Regular expressions for valid control codes
37+
*
38+
* @var string
39+
*/
40+
protected $controlCodeRegex = '/\A[\r\n\t[:^cntrl:]]*\z/u';
41+
3542
/**
3643
* Check invalid characters.
3744
*
@@ -107,7 +114,7 @@ protected function checkControl($value)
107114
return $value;
108115
}
109116

110-
if (preg_match('/\A[\r\n\t[:^cntrl:]]*\z/u', $value) === 1) {
117+
if (preg_match($this->controlCodeRegex, $value) === 1) {
111118
return $value;
112119
}
113120

0 commit comments

Comments
 (0)