new#
הידור תבנית לעצם Peta::FFI::PCRE2.
$options הוא OR סיביות של קבועי ההידור PCRE2_* (ברירת מחדל 0). תבנית המסומנת בדגל UTF8 מוסיפה אוטומטית PCRE2_UTF|PCRE2_NO_UTF_CHECK. התבנית עוברת הידור JIT כאשר הספרייה תומכת בכך; jit מדווחת אם זה הצליח. עושה croak עם ההודעה של PCRE2 ועם היסט הבתים כאשר התבנית פגומה.
Limits on every match of the pattern follow $options as name-value pairs, each an unsigned 32-bit number:
match_limit- how often the matcher may go round its main loop, which bounds the backtracking a pattern like^(a+)+$can do.depth_limit- how deeply backtracking may nest.heap_limit- the heap, in KiB, a match may use for backtracking.
Without them PCRE2’s built-in defaults apply. A match that reaches a limit croaks as any match error does, and limit_hit counts it. The JIT honours only match_limit, so a pattern given depth_limit or heap_limit is not JIT-compiled.
תקציר#
my $re = Peta::FFI::PCRE2->new("a[act]ggtaaa|tttacc[agt]t");
my $ci = Peta::FFI::PCRE2->new("hello", PCRE2_CASELESS);
my $user = Peta::FFI::PCRE2->new($untrusted, 0, match_limit => 100_000);