Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.5.5 (abort with ^G)
1> erl_ddll:load_driver(code:priv_dir(treregex)++"/bin", "TRE_drv").
ok
2> f(RE), {ok, RE} = treregex:compile(<<"fear">>, [extended]).
{ok,#Port<0.74>}
3> treregex:approx(RE, <<"fir">>, 0, []).
{error,nomatch}
4> treregex:approx(RE, <<"fir">>, 1, []).
{error,nomatch}
5> treregex:approx(RE, <<"fir">>, 2, []).
{ok,[{0,3}]}
6> treregex:approx(RE, <<"fir">>, 1, []).
{error,nomatch}
7> treregex:exec(RE, <<"fir">>).
{error,nomatch}
8> treregex:free(RE).
ok
9> f(RE), {ok, RE} = treregex:compile(<<"loubov">>, [extended]).
{ok,#Port<0.76>}
10> treregex:approx(RE, <<"love">>, 3, []).
{ok,[{0,3}]}
11> treregex:approx(RE, <<"to love">>, 0, []).
{error,nomatch}
12> treregex:approx(RE, <<"to love">>, 1, []).
{error,nomatch}
13> treregex:approx(RE, <<"to love">>, 2, []).
{error,nomatch}
14> treregex:approx(RE, <<"to love">>, 3, []).
{ok,[{0,6}]}
15> treregex:approx(RE, <<"aimer">>, 3, []).
{error,nomatch}
16> treregex:approx(RE, <<"aimour">>, 3, []).
{error,nomatch}
17> treregex:approx(RE, <<"amour">>, 3, []).
{error,nomatch}
18> treregex:approx(RE, <<"amour">>, 10, []).
{ok,[{1,6}]}
Wednesday, October 17, 2007
LibTRE in Action, the approximative match
Here's a sample session showing some of the libTre features:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment