protected function isValidTagAttribute(array $tagAttributes, BBCodeAttribute $definedTagAttribute) {
if ($definedTagAttribute->validationPattern && isset($tagAttributes[$definedTagAttribute->attributeNo])) {
// validate attribute
- if (!preg_match('~'.$definedTagAttribute->validationPattern.'~i', $tagAttributes[$definedTagAttribute->attributeNo])) {
+ if (!preg_match('~'.str_replace('~', '\~', $definedTagAttribute->validationPattern).'~i', $tagAttributes[$definedTagAttribute->attributeNo])) {
return false;
}
}
// validate with pattern
if ($option->validationPattern) {
- if (!preg_match('~'.$option->validationPattern.'~', $this->optionValues[$option->optionName])) {
+ if (!preg_match('~'.str_replace('~', '\~', $option->validationPattern).'~', $this->optionValues[$option->optionName])) {
throw new UserInputException($option->optionName, 'validationFailed');
}
}