Pomocnicze metody
Budowę wyrażenia regularnego zaczynasz od użycia Regex::build().
Pozostałe metody pomocnicze wykorzystują build() przy tworzeniu wzorca.
build
Metoda build rozpoczyna każde tworzenie wyrażenia Rudashi\FluentBuilder.
use Rudashi\Regex;
$builder = Regex::build();
// Rudashi\FluentBuilder
Można również przekazać tablicę predefiniowanych wzorców do użycia w danym ciągu kontekstowym:
use Rudashi\Regex;
$builder = Regex::build([
Rudashi\Patterns\EmailPattern::class,
]);
for
Metoda for dodaje kontekst dla instancji Rudashi\FluentBuilder. Będzie to tekst, na którym chcesz, żeby wyrażenie regularne zadziałało.
use Rudashi\Regex;
$builder = Regex::for('Hello, world!');
// Rudashi\FluentBuilder
start
Metoda start dodaje flagę start.
use Rudashi\Regex;
$pattern = Regex::start();
// /^/
startOfLine
Metoda startOfLine jest odpowiednikiem dla metody Regex::start.
use Rudashi\Regex;
$pattern = Regex::startOfLine();
// /^/