PHP mod_korean extension Reference
  • Introduction
  • Installation
  • APIs
    • Check Functions
      • check_filename_lib
      • check_htmltbale_lib
      • check_uristr_lib
      • get_microtime_lib
      • human_fsize_lib
      • is_email_lib
      • is_hangul_lib
      • is_iis_lib
      • is_url_lib
      • is_windows_lib
      • buildno_lib
      • version_lib
    • Filesystem Functions
      • filelist_lib
      • getfile_lib
      • getfiletype_lib
      • putfile_lib
      • readfile_lib
      • pcregrep_lib
    • HTML Functions
      • agentinfo_lib
      • autolink_lib
      • get_hostname_lib
      • movepage_lib
      • perror_lib
      • pnotice_lib
    • Charset Functions
      • ncrencode_lib
      • ncrdecode_lib
      • uniencode_lib
      • unidecode_lib
      • utf8encode_lib
      • utf8decode_lib
      • substr_lib
      • postposition_lib
    • Image Functions
      • imgresize_lib
    • Mail Functions
      • mailsource_lib
      • sockmail_lib
Powered by GitBook
On this page
  • Proto type
  • Description
  • Arguments
  • Example
  • See also

Was this helpful?

  1. APIs
  2. Filesystem Functions

pcregrep_lib

Proto type

string pcregrep_lib(string regex, string text [, int opt])

Description

시스템의 grep 과 비슷한 역할을 한다. text 에 주어진 문자열에서 regex 와 매치되는 행을 변수로 받는다. opt 를 1 로 주었을 경우, regex 와 매치되지 않는 행만 변수로 받는다.

정규식은 pcre 호환 정규식이 적용이 된다.

Arguments

(string) regex - matching condition

(string) text - raw data

(int) opt (optional) - revert condition

Example

<?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

None

Previousreadfile_libNextHTML Functions

Last updated 5 years ago

Was this helpful?