]> granicus.if.org Git - ejabberd/commitdiff
Replace regexp with ejabberd_regexp
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 19 Dec 2011 06:10:48 +0000 (16:10 +1000)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 19 Dec 2011 06:10:48 +0000 (16:10 +1000)
src/eldap/eldap_utils.erl

index 66a1fcfefea5b4dea09a4275b64055f964685390..056499d4adb133cde9bf6d22f727ddc02b1c5c18 100644 (file)
@@ -94,17 +94,18 @@ get_user_part(String, Pattern) ->
        {'EXIT', _} ->
            {error, badmatch};
        Result ->
-           case regexp:sub(Pattern, "%u", Result) of
-               {ok, StringRes, _} ->
+            case catch ejabberd_regexp:replace(Pattern, "%u", Result) of
+                {'EXIT', _} ->
+                    {error, badmatch};
+               StringRes ->
                     case (string:to_lower(StringRes) ==
                               string:to_lower(String)) of
                         true ->
                             {ok, Result};
                         false ->
                             {error, badmatch}
-                    end;
-               _ -> {error, badmatch}
-           end
+                    end
+            end
     end.
 
 make_filter(Data, UIDs) ->