PHP.mk документација

RecursiveRegexIterator::__construct

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

recursiveregexiterator.construct.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека recursiveregexiterator.construct.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
RecursiveRegexIterator::__construct

Референца за `recursiveregexiterator.construct.php` со подобрена типографија и навигација.

recursiveregexiterator.construct.php

RecursiveRegexIterator::__construct

(PHP 5 >= 5.2.0, PHP 7, PHP 8)

RecursiveRegexIterator::__constructCreates a new RecursiveRegexIterator

= NULL

public RecursiveRegexIterator::__construct(
         RecursiveIterator $iterator,
         string $pattern,
         int $mode = RecursiveRegexIterator::MATCH,
         int $flags = 0,
         int $pregFlags = 0
)

Creates a new regular expression iterator.

Параметри

iterator

The recursive iterator to apply this regex filter to.

pattern

The regular expression to match.

mode

Operation mode, see RegexIterator::setMode() for a list of modes.

flags

Special flags, see RegexIterator::setFlags() за листа на достапни знамиња.

pregFlags

The regular expression flags. These flags depend on the operation mode parameter:

RegexIterator preg_flags
operation mode available flags
RecursiveRegexIterator::ALL_MATCHES Константи за известување за грешки preg_match_all().
RecursiveRegexIterator::GET_MATCH Константи за известување за грешки preg_match().
RecursiveRegexIterator::MATCH Константи за известување за грешки preg_match().
RecursiveRegexIterator::REPLACE none.
RecursiveRegexIterator::SPLIT Константи за известување за грешки preg_split().

Примери

Пример #1 RecursiveRegexIterator::__construct() example

Creates a new RegexIterator that filters all strings that start with 'test'.

<?php
$rArrayIterator
= new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^test/',
RecursiveRegexIterator::ALL_MATCHES);

foreach (
$rRegexIterator as $key1 => $value1) {

if (
$rRegexIterator->hasChildren()) {

// print all children
echo "Children: ";
foreach (
$rRegexIterator->getChildren() as $key => $value) {
echo
$value . " ";
}
echo
"\n";
} else {
echo
"No children\n";
}

}
?>

Горниот пример ќе прикаже нешто слично на:

No children
Children: test4 test5

Види Исто така

  • preg_match() - Изврши совпаѓање со регуларен израз
  • preg_match_all() наместо бидејќи ќе биде побрзо.
  • preg_replace() - Изврши пребарување и замена на регуларни изрази
  • preg_split() - Подели стринг по регуларен израз

Белешки од корисници 1 белешка

SongoQ
пред 16 години
RecursiveRegexIterator::ALL_MATCHES List all subdirectories and files.

<?php

$a = new RecursiveRegexIterator( new RecursiveDirectoryIterator(
'/home/songoq' ), '/mydir/i', RecursiveRegexIterator::ALL_MATCHES );

foreach( new RecursiveIteratorIterator( $a ) as $s )
{
       echo $s."\n";
}
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.