From f56afb1ea2dbd59262947ed27bb1913394aeb5c6 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Sat, 15 Aug 2009 02:09:16 +0000 Subject: replace regexp with re. Thanks Kim Shrier, Gordon Stratton. Closes COUCHDB-245 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@804428 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd_db.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/couchdb/couch_httpd_db.erl') diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index 915a5eae..a3ac69ae 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -496,8 +496,8 @@ db_req(#httpd{path_parts=[_,<<"_revs_limit">>]}=Req, _Db) -> % as slashes in document IDs must otherwise be URL encoded. db_req(#httpd{method='GET',mochi_req=MochiReq, path_parts=[DbName,<<"_design/",_/binary>>|_]}=Req, _Db) -> PathFront = "/" ++ couch_httpd:quote(binary_to_list(DbName)) ++ "/", - RawSplit = regexp:split(MochiReq:get(raw_path),"_design%2F"), - {ok, [PathFront|PathTail]} = RawSplit, + [PathFront|PathTail] = re:split(MochiReq:get(raw_path), "_design%2F", + [{return, list}]), couch_httpd:send_redirect(Req, PathFront ++ "_design/" ++ mochiweb_util:join(PathTail, "_design%2F")); @@ -1008,12 +1008,12 @@ extract_header_rev(Req, ExplicitRev) -> parse_copy_destination_header(Req) -> Destination = couch_httpd:header_value(Req, "Destination"), - case regexp:match(Destination, "\\?") of + case re:run(Destination, "\\?", [{capture, none}]) of nomatch -> {list_to_binary(Destination), {0, []}}; - {match, _, _} -> - {ok, [DocId, RevQueryOptions]} = regexp:split(Destination, "\\?"), - {ok, [_RevQueryKey, Rev]} = regexp:split(RevQueryOptions, "="), + match -> + [DocId, RevQs] = re:split(Destination, "\\?", [{return, list}]), + [_RevQueryKey, Rev] = re:split(RevQs, "=", [{return, list}]), {Pos, RevId} = couch_doc:parse_rev(Rev), {list_to_binary(DocId), {Pos, [RevId]}} end. -- cgit v1.2.3