Add couch_debug:opened_files_by_regexp/1

couch_debug:opened_files_by_regexp is an efficient way to find out list
of file descriptors or couch_file processes which path matches given
regexp
diff --git a/src/couch_debug.erl b/src/couch_debug.erl
index 31b4c5c..e2d5ea1 100644
--- a/src/couch_debug.erl
+++ b/src/couch_debug.erl
@@ -12,7 +12,10 @@
 
 -module(couch_debug).
 
--export([opened_files/0]).
+-export([
+    opened_files/0,
+    opened_files_by_regexp/1
+]).
 
 -spec opened_files() ->
     [{port(), CouchFilePid :: pid(), Fd :: pid() | tuple(), FilePath :: string()}].
@@ -31,3 +34,11 @@
         undefined ->
             undefined
     end.
+
+-spec opened_files_by_regexp(FileRegExp :: iodata()) ->
+    [{port(), CouchFilePid :: pid(), Fd :: pid() | tuple(), FilePath :: string()}].
+opened_files_by_regexp(FileRegExp) ->
+    {ok, RegExp} = re:compile(FileRegExp),
+    lists:filter(fun({_Port, _Pid, _Fd, Path}) ->
+        re:run(Path, RegExp) =/= nomatch
+    end, couch_debug:opened_files()).