TITLE ^

pcre.pir - user interface to Perl-Compatible Regular Expression library

SYNOPSIS ^

    load_bytecode 'library/pcre.pir'
    lib = pcre_init()

    func = find_global 'PCRE', 'compile'
    ( regex, error, errptr )= func( pat, options )

    func = find_global 'PCRE', 'match'
    ( ok, result )= func( regex, string, start, options )

    func = find_global 'PCRE', 'dollar'
    match = func( string, ok, result, i )

DESCRIPTION ^

This is the user interface to PCRE. Use this to initialize the library, compile regexes, match against strings, and return the results. All functions are found in the 'PCRE' namespace.

The NCI interface is contained in libpcre.pir.

sub init()

Intialize the pcre library. The library handle is returned as a PMC and is additionally stored as global 'PCRE', 'lib'.

sub ( regex, error, errptr )= compile( pattern, options )

Compile the string pattern with int options. Returns pmc regex, string error and int errptr.

sub ( ok, result )= match( regex, string, start, options ) sub match ()= match()

Match the pmc regex against string string from int start with int options. Returns the number of matches in int ok and the ovector in pmc result.

sub match= dollar( string, ok, result, i )

Extract from string string the int ith result into string match. Returns the match.

sub (string)= version()

BUGS ^

None known, but this hasn't been well tested. This interface is designed to work on all platforms where PCRE and parrot are supported, but has not been tested on all of them. Send bug reports to <parrotbug@parrotcode.org<gt>

FILES ^

pcre.pir, libpcre.pir

SEE ALSO ^

pcre(3)

AUTHORS ^

Original code by Leo Toetsch, updated by Jerry Gay <jerry dot gay at gmail dot com<gt>


parrot