Module perlre

Using perl regexp from erlang.

Copyright © 2007 YAMASHINA Hio

Version: 0.08

Authors: YAMASHINA Hio (hio@hio.jp).

Description

Using perl regexp from erlang.

Regexp Options

These options are available for Options argument of match/3 and compile/2.

Data Types

rx()

rx() = {prx, X}

compiled regexp object.

Function Index

compile/1compile pattern.
compile/2
gsub/3replace substring which matches Regexp with Replacement.
match/2search a string for pattern.
match/3search a string for pattern.
start/0 start port driver.
stop/0 stop perlre port service.

Function Details

compile/1

compile(Regexp) -> Rx

compile pattern.

Examples for compile/1

    {ok,Rx}=perlre:compile("(\\w+)").
    {ok,["abc"]}=perlre:match("abc",Rx).
    nomatch=perlre:match("---",Rx).
    {error,ErrMsg}=perlre:compile("(").

compile/2

compile() -> term()

gsub/3

gsub(String, Regexp, Replacement) -> string()

replace substring which matches Regexp with Replacement.

Examples for compile/1

    {ok,"ab.ab"}=perlre:gsub("12.34","\\d+","ab")
    {nomatch,"12.34"}=perlre:gsub("12.34","\\s+","XX")
    {error,ErrMsg}=perlre:gsub("abc","(","").

match/2

match(String, Regexp) -> Result

Equivalent to match(String, Regexp, []).

search a string for pattern.

Examples for match/2

    {match, ["123", "abc"]} = perlre:match("123abc", "(\\d+)(\\w+)").
    nomatch = perlre:match("123abc", "(\s+)").
    {error, ErrMsg} = perlre:match("123abc", "(\s+)").

match/3

match(String, Regexp, Options) -> Result

search a string for pattern. See Regexp Options for available options.

start/0

start() -> term()

start port driver

stop/0

stop() -> ok

stop perlre port service.


Generated by EDoc, Jun 11 2007, 17:07:52.