PregParser Class Reference

Inheritance diagram for PregParser:

MakrellParser PregClipboard Makrell

List of all members.


Detailed Description

Pcre library wrapper, provides more unified and convenient interface.

Public Member Functions

 repeat ($func, $count, $text)
 Repeatedly apply the transformation callback $func to $text. The callback takes $text param and is supposed to return the transformed text. If count is > 0, the function is applied at most $count times. If count is < 0, the function is applied at most $this->limit times. In both cases, the function stops if the $text isn't changing anymore (i.e. callback returns the same text). The callback receives the $text as a parameter, if repeat is called with more params, they are also sent to the callback.
 ssub ($text, $from, $to)
 str_repace wrapper. Replace string $from with $to in text $text.
 gsub ($text, $regexp, $replacement, $count=1)
 Replace $regexp with $replacement in $text. $count is the same as in repeat().
 gfun ($text, $regexp, $func, $count=1)
 Replace $regexp in $text using $func as a callback function. Callback must follow preg_replace_callback rules (i.e. it takes an array of matches). Function names starting with a dot are treated as methods of $this object, i.e. gfun(foo, bar, '.baz') is the same as gfun(foo, bar, array($this, 'baz')).
 ksub ($text, $pairs, $count=1)
 Replace the keys of $pairs with the values of $pairs. $pairs is an associative array, whose keys are regexps and values are replacements.
 kfun ($text, $pairs, $count=1)
 Replace the keys of $pairs by calling corresponding callbacks. $pairs is an associative array, whose keys are regexps and values are callback functions.
 match ($text, $regexp)
 preg_match wrapper. Returns an array of matches or an empty array.
 match_all ($text, $regexp, $flags=0)
 preg_match_all wrapper. Returns an array of matches or an empty array.

Public Attributes

 $limit = 32
 Maximal number of passes for repeat().

The documentation for this class was generated from the following file:

Generated on Tue May 20 13:52:05 2008 for makrell by  doxygen 1.5.5