public function addPatternModifier($modifier)
{
if (!strlen($modifier) == 1 || !strstr(self::ALLOWED_MODIFIERS, $modifier)) {
throw new RuntimeException('Invalid regex modifier: ' . $modifier);
}
// Find all modifiers of current regex:
$modifiersPattern = '/([' . self::ALLOWED_MODIFIERS . ']*$)/';
preg_match($modifiersPattern, $this->regex, $matches);
$modifiers = $matches[0];
// Skip if the modifier is already available
if (strstr($modifiers, $modifier) !== false) {
return;
}
$this->regex .= $modifier;
}