In a list context, all Text::Balanced methods return a list that
contains the extracted string with delimiters, the remainder of the
string, and the parts of the string that were skipped. Text::Balanced
is shipped with the Perl source kit as of 5.8.
Text::Balanced implements the following methods.
extract_bracketed(text, delimiter)
Extracts the initial substring of textthat is bracketed with delimiters specified by
delimiter. Note that
delimiter should contain one of
(), {}, [],
or <>.
extract_codeblock(text, delimiter)
Extracts the initial substring of textthat represents a block of Perl code. This code is specified by
delimiter, which contains one of
(), {}, [],
or <>.
extract_delimited(text, delimiter)
Extracts the initial substring of textthat is delimited by two instances of
delimiter.
extract_multple(text ...)
Extracts the initial substrings of textthat would be extracted by one or more sequential applications of the
specified functions.
extract_quotelike(text)
Extracts the quoted portion of text.
extract_tagged(text, "TAG1", "TAG2", undef, nesting_allowed)
Extracts the initial substring of textthat is bounded by an HTML or XML tag:
# Extract HTML tags but don't allow <HTML> to be embedded
($extracted, $left) =
extract_tagged($text,"<HTML>","</HTML>",
undef,{bad=>["<HTML>"]});
extract_multiple($text, ...)
gen_delimited_pat(q{pattern})
Creates a string that represents the optimized pattern that matches a
substring delimited by q{
pattern}.