Hallo,
Wo bitte? Ich bin wohl leider zu blind, es zu finden.
User Contributed Notes: 2/2
und im Text, ich zitiere
"It is also possible to unset these options by preceding
the letter with a hyphen"
Testen wir das Verhalten mit folgenem Codefragment:
$haystack = array(
'abcd',
'abCd',
'abCD',
'abcD');
$pattern = '/ab(?i)c(?-i)d/';
$result = array();
# Testen wir den RegEx
foreach ($haystack as $needle) {
$matches = array();
$match = '';
if (preg_match($pattern, $needle, $matches)) {
# es kann maximal ein Match geben :-)
$match = $matches[0];
}
$result[$needle] = $match;
}
# und schauen uns das Ergebnis an:
echo "<pre>\n";
foreach($result as $key => $value) {
echo $key, " => ", $value, "\n";
}
echo "</pre>\n";
/*
gibt folgendes aus:
abcd => abcd
abCd => abCd
abCD =>
abcD =>
*/
Passt!
Zusätzlich gilt, dass innerhalb eines Subpatterns die Änderung nur für das Subpattern gilt. Über diese Schiene kannst Du ebenfalls unterschiedliche Optionen nutzen.
Freundliche Grüße
Vinzenz