 |
สอบถามปัญหา ตัว pattern ของ Regular Expression Function |
|
 |
|
|
 |
 |
|
<?php
$str = <<<EEE
abc
<div>
bbb
</div>
def
EEE;
preg_match_all('|<div>.*</div>|',$str,$m);
echo htmlspecialchars(var_export($m,1)),'<hr>';
preg_match_all('|<div>.*</div>|s',$str,$m);
echo htmlspecialchars(var_export($m,1));
?>
s (PCRE_DOTALL)
If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.
ตั้งค่า pattern modifier ครับ
|
 |
 |
 |
 |
Date :
2012-09-14 20:58:12 |
By :
num |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|