substitute#

Replace matches of the pattern in a subject, returning a new string.

Global by default (PCRE2_SUBSTITUTE_GLOBAL); pass an explicit $options value to override; it replaces the default rather than adding to it, so include PCRE2_SUBSTITUTE_GLOBAL yourself if you still want all occurrences. The replacement uses PCRE2 substitution syntax ($1, ${name}; \ escapes with PCRE2_SUBSTITUTE_EXTENDED). The subject is not modified, and a UTF8-flagged subject yields a UTF8-flagged result.

Synopsis#

my $clean = Peta::PCRE2->new(">.*\\n|\\n")->substitute($fasta, "");