Esempio n. 1
0
 /**
  * @uses   $this->regex
  * @param  mixed $data
  * @return array matches
  */
 protected function get($data)
 {
     $dataExtended = $data;
     if (is_array($data)) {
         $dataExtended = implode(" ", $data);
     }
     $matches = pregMatchAll($dataExtended, $this->regex);
     if (is_array($matches)) {
         $matches = Arr::flatten($matches);
     }
     if (is_array($matches) && count($matches) === 0 && $this->outPorts['error']->isAttached()) {
         $this->outPorts['error']->send($matches);
     }
     Emitter::emit('regex.inout', $matches, static::class);
     return $matches;
 }
Esempio n. 2
0
<?php

switch ($_GET['o']) {
    case 0:
        //preg_match_all
        pregMatchAll($_GET['r'], $_GET['s']);
        break;
    case 1:
        //preg_match
        pregMatch($_GET['r'], $_GET['s']);
        break;
    case 2:
        //preg_split
        pregSplit($_GET['r'], $_GET['s']);
        break;
}
$flag = $_GET['f'];
/*
 *
 */
function pregMatch($regex, $str)
{
    if (isset($flag) && $flag != null && $flag != "") {
        @preg_match("{$regex}", "{$str}", $match, $flag);
    } else {
        @preg_match("{$regex}", "{$str}", $match);
    }
    print_r($match);
}
/*
 *