Permalink
Browse files

change regexp to re and allowing R15 in reber.config

  • Loading branch information...
michalwski committed Mar 19, 2012
1 parent 673a5ac commit 16ca1c24c5674af19b0479fa0772c9df1b267f6e
Showing with 5 additions and 23 deletions.
  1. +4 −22 apps/ejabberd/src/eldap_filter.erl
  2. +1 −1 rebar.config
@@ -143,32 +143,14 @@ do_sub(S, [{RegExp, New, Times} | T]) ->
Result = do_sub(S, {RegExp, replace_amps(New), Times}, 1),
do_sub(Result, T).
-do_sub(S, {RegExp, New}, Iter) ->
- case regexp:sub(S, RegExp, New) of
- {ok, NewS, 0} ->
- NewS;
- {ok, NewS, _} when Iter =< ?MAX_RECURSION ->
- do_sub(NewS, {RegExp, New}, Iter+1);
- {ok, _, _} when Iter > ?MAX_RECURSION ->
- erlang:error(max_substitute_recursion);
- _ ->
- erlang:error(bad_regexp)
- end;
+do_sub(S, {RegExp, New}, _Iter) ->
+ re:replace(S, RegExp, New, [global, {return, list}]);
do_sub(S, {_, _, N}, _) when N<1 ->
S;
-do_sub(S, {RegExp, New, Times}, Iter) ->
- case regexp:sub(S, RegExp, New) of
- {ok, NewS, 0} ->
- NewS;
- {ok, NewS, _} when Iter < Times ->
- do_sub(NewS, {RegExp, New, Times}, Iter+1);
- {ok, NewS, _} ->
- NewS;
- _ ->
- erlang:error(bad_regexp)
- end.
+do_sub(S, {RegExp, New, _Times}, _Iter) ->
+ re:replace(S, RegExp, New, [global, {return, list}]).
replace_amps(String) ->
lists:flatmap(
View
@@ -1,7 +1,7 @@
{erl_opts, [debug_info,
{i, ["include"]}]}.
-{require_otp_vsn, "R14"}.
+{require_otp_vsn, "R1[45]"}.
{so_specs,
[{"priv/lib/tls_drv.so",

0 comments on commit 16ca1c2

Please sign in to comment.