pcregrep_lib
Proto type
string pcregrep_lib(string regex, string text [, int opt])Description
Arguments
(string) regex - matching condition
(string) text - raw data
(int) opt (optional) - revert conditionExample
<?php
$a = <<<EOF
I'm a boy
You are the student
Am I Oh happy?
Oh no, I'm crazy
Oh no, I'M sexy girl
EOF;
echo pcregrep_lib ('/I\'m/i', $a);
/* RESUTL:
I'm a boy
Oh no, I'm crazy
Oh no, I'M sexy girl
*/
echo pcregrep_lib ('/I\'M/', $a);
/* RESULT:
Oh no, I'M sexy girl
*/
echo pcregrep_lib ('/I\'M/', $a, 1);
/* RESULT:
I'm a boy
You are the student
Am I Oh happy?
Oh no, I'm crazy
*/
echo pcregrep_lib('/^I/', $a, 1);
/* RESULT
You are the student
Am I Oh happy?
Oh no, I'm crazy
Oh no, I'M sexy girl
*/
?>See also
Last updated