From fe084d5d867de8839385c3652a0f727f97500a0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 9 Aug 2011 14:17:44 +0200
Subject: inviso: Eliminate use of deprecated regexp module

---
 lib/inviso/src/inviso_tool_lib.erl      |  8 ++++----
 lib/runtime_tools/src/inviso_rt.erl     |  4 ++--
 lib/runtime_tools/src/inviso_rt_lib.erl | 16 ++++++++--------
 lib/runtime_tools/test/inviso_SUITE.erl | 22 ++++++++++++----------
 4 files changed, 26 insertions(+), 24 deletions(-)

(limited to 'lib')

diff --git a/lib/inviso/src/inviso_tool_lib.erl b/lib/inviso/src/inviso_tool_lib.erl
index 7953acedd6..f221c4b6de 100644
--- a/lib/inviso/src/inviso_tool_lib.erl
+++ b/lib/inviso/src/inviso_tool_lib.erl
@@ -19,7 +19,7 @@
 %% Support module to the inviso tool.
 %%
 %% Authors:
-%% Lennart �hman, lennart.ohman@st.se
+%% Lennart Öhman, lennart.ohman@st.se
 %% -----------------------------------------------------------------------------
 
 -module(inviso_tool_lib).
@@ -145,10 +145,10 @@ expand_module_names_2(Nodes,DirStr,ModStr,Opts) ->
 %% Always returns a regexp or {error,Reason}. 
 expand_module_names_special_regexp(Str) ->
     StrLen=length(Str),
-    case regexp:first_match(Str,"[0-9a-zA-Z_/]*") of
-	{match,1,StrLen} ->                  % Ok, it is the special case.
+    case re:run(Str,"[0-9a-zA-Z_/]*") of
+	{match,[{0,StrLen}]} ->	             % Ok, it is the special case.
 	    {ok,".*"++Str++".*"};            % Convert it to a proper regexp.
-	{match,_,_} ->
+	{match,_} ->
 	    {ok,Str};                        % Keep it and hope it is a regexp.
 	nomatch ->
 	    {ok,Str};                        % Keep it and hope it is a regexp.
diff --git a/lib/runtime_tools/src/inviso_rt.erl b/lib/runtime_tools/src/inviso_rt.erl
index ac7ac2a584..b162f5b045 100644
--- a/lib/runtime_tools/src/inviso_rt.erl
+++ b/lib/runtime_tools/src/inviso_rt.erl
@@ -2359,8 +2359,8 @@ list_wrapset(Prefix,Suffix) ->
 
 list_wrapset_2([File|Rest],RegExp) ->
     Length=length(File),
-    case regexp:first_match(File,RegExp) of
-	{match,1,Length} ->                  % This is a member of the set.
+    case re:run(File,RegExp) of
+	{match,[{0,Length}]} ->                  % This is a member of the set.
 	    [File|list_wrapset_2(Rest,RegExp)];
 	_ ->
 	    list_wrapset_2(Rest,RegExp)
diff --git a/lib/runtime_tools/src/inviso_rt_lib.erl b/lib/runtime_tools/src/inviso_rt_lib.erl
index 2c6964e53e..ee6a72ae0c 100644
--- a/lib/runtime_tools/src/inviso_rt_lib.erl
+++ b/lib/runtime_tools/src/inviso_rt_lib.erl
@@ -197,15 +197,15 @@ match_modules(RegExpDir,RegExpMod,Actions) ->
 handle_expand_regexp_2([{Mod,Path}|Rest],RegExpDir,RegExpMod,Result) ->
     ModStr=atom_to_list(Mod),
     ModLen=length(ModStr),
-    case regexp:first_match(ModStr,RegExpMod) of
-	{match,1,ModLen} ->                  % Ok, The regexp matches the module.
+    case re:run(ModStr,RegExpMod) of
+	{match,[{0,ModLen}]} ->                  % Ok, The regexp matches the module.
 	    if
 		is_list(RegExpDir),is_atom(Path) -> % Preloaded or covercompiled...
 		    handle_expand_regexp_2(Rest,RegExpDir,RegExpMod,Result);
 		is_list(RegExpDir),is_list(Path) -> % Dir reg-exp is used!
 		    PathOnly=filename:dirname(Path), % Must remove beam-file name.
-		    case regexp:first_match(PathOnly,RegExpDir) of
-			{match,_,_} ->       % Did find a match, that is enough!
+		    case re:run(PathOnly,RegExpDir,[{capture,none}]) of
+			match ->             % Did find a match, that is enough!
 			    handle_expand_regexp_2(Rest,RegExpDir,RegExpMod,[Mod|Result]);
 			_ ->                 % Either error or nomatch.
 			    handle_expand_regexp_2(Rest,RegExpDir,RegExpMod,Result)
@@ -233,8 +233,8 @@ handle_expand_regexp_3([Path|Rest],RegExpDir,RegExpMod,AllLoaded,Result) ->
 		    volumerelative ->        % Only on Windows!?
 			filename:absname(Path)
 		end,
-	    case regexp:first_match(AbsPath,RegExpDir) of
-		{match,_,_} ->               % Ok, the directory is allowed.
+	    case re:run(AbsPath,RegExpDir,[{capture,none}]) of
+		match ->                     % Ok, the directory is allowed.
 		    NewResult=handle_expand_regexp_3_1(Path,RegExpMod,AllLoaded,Result),
 		    handle_expand_regexp_3(Rest,RegExpDir,RegExpMod,AllLoaded,NewResult);
 		_ ->                         % This directory does not qualify.
@@ -262,8 +262,8 @@ handle_expand_regexp_3_2([File|Rest],RegExpMod,AllLoaded,Result) ->
 	    case {lists:keysearch(Mod,1,AllLoaded),lists:member(Mod,Result)} of
 		{false,false} ->             % This module is not tried before.
 		    ModLen=length(ModStr),
-		    case regexp:first_match(ModStr,RegExpMod) of
-			{match,1,ModLen} ->  % This module satisfies the regexp.
+		    case re:run(ModStr,RegExpMod) of
+			{match,[{0,ModLen}]} ->  % This module satisfies the regexp.
 			    handle_expand_regexp_3_2(Rest,RegExpMod,AllLoaded,[Mod|Result]);
 			_ ->                 % Error or not perfect match.
 			    handle_expand_regexp_3_2(Rest,RegExpMod,AllLoaded,Result)
diff --git a/lib/runtime_tools/test/inviso_SUITE.erl b/lib/runtime_tools/test/inviso_SUITE.erl
index 3ae8d34dd6..758867cf45 100644
--- a/lib/runtime_tools/test/inviso_SUITE.erl
+++ b/lib/runtime_tools/test/inviso_SUITE.erl
@@ -1380,9 +1380,10 @@ fetch_log_dist_trace_2(Config) ->
     io:format("~p~n",[NodeResults]),
     CheckFun=fun({N,{complete,[{trace_log,FileResults1},{ti_log,[{ok,TiFile}]}]}}) ->
 		     Fun2=fun({ok,File}) ->
-				  {match,1,_}=
-				      regexp:first_match(File,
-							 "^"++"p1"++Name++atom_to_list(N)),
+				  match=
+				      re:run(File,
+					     "^"++"p1"++Name++atom_to_list(N),
+					     [{capture,none}]),
 				  true;
 			     (_) ->
 				  false
@@ -1425,8 +1426,8 @@ fetch_log_dist_trace_3(Config) ->
     CheckFun=fun({N,{ok,[{trace_log,PrivDir2,[F1,F2]},{ti_log,PrivDir2,[F3]}]}})->
 		     PrivDir2=PrivDir,
 		     RegExp="^"++Name++atom_to_list(N)++"[0-9]+"++"\.log",
-		     {match,1,_}=regexp:first_match(F1,RegExp),
-		     {match,1,_}=regexp:first_match(F2,RegExp),
+		     match=re:run(F1,RegExp,[{capture,none}]),
+		     match=re:run(F2,RegExp,[{capture,none}]),
 		     F3=Name++"_ti_"++atom_to_list(N)++".ti",
 		     true;
 		(_) ->
@@ -1439,9 +1440,10 @@ fetch_log_dist_trace_3(Config) ->
 io:format("~p~n",[NodeResults2]),
     CheckFun2=fun({N,{complete,[{trace_log,FileResults1},{ti_log,[{ok,TiFile}]}]}}) ->
 		     Fun2=fun({ok,File}) ->
-				  {match,1,_}=
-				      regexp:first_match(File,
-							 "^"++"p1"++Name++atom_to_list(N)),
+				  match=
+				      re:run(File,
+					     "^"++"p1"++Name++atom_to_list(N),
+					    [{capture,none}]),
 				  true;
 			     (_) ->
 				  false
@@ -2649,8 +2651,8 @@ check_on_nodes([],_,_,_,_) ->
 how_many_files_regexp([],_,N) ->
     {ok,N};
 how_many_files_regexp([FName|Rest],RegExp,N) ->
-    case regexp:first_match(FName,RegExp) of
-	{match,1,_} ->
+    case re:run(FName,RegExp,[{capture,none}]) of
+	match ->
 	    how_many_files_regexp(Rest,RegExp,N+1);
 	nomatch ->
 	    how_many_files_regexp(Rest,RegExp,N);
-- 
cgit v1.2.3


From 9e034e51ca0f051b62e389545b3f5a56b9cec393 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 25 Aug 2011 12:08:29 +0200
Subject: gs: Eliminate use of deprecated regexp module

---
 lib/gs/src/gstk_editor.erl  | 4 ++--
 lib/gs/src/gstk_generic.erl | 2 +-
 lib/gs/src/gstk_image.erl   | 4 ++--
 lib/gs/src/tool_utils.erl   | 3 ++-
 4 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'lib')

diff --git a/lib/gs/src/gstk_editor.erl b/lib/gs/src/gstk_editor.erl
index 3e0c8240e4..8cc7021cc6 100644
--- a/lib/gs/src/gstk_editor.erl
+++ b/lib/gs/src/gstk_editor.erl
@@ -243,14 +243,14 @@ option(Option, Gstkid, _MainW, DB, Editor) ->
 		 Editor, " ins ",AI," ", gstk:to_ascii(Text)]};
 	clear       -> {c, [Editor, " delete 1.0 end"]};
 	{load,        File} ->
-	    {ok, F2,_} = regexp:gsub(File, [92,92], "/"),
+	    F2 = re:replace(File, [92,92], "/", [global,{return,list}]),
 	    case gstk:call(["ed_load ", Editor, " ", gstk:to_ascii(F2)]) of
 		{result,    _} -> none;
 		{bad_result,Re} -> 
 		    {error,{no_such_file,editor,load,F2,Re}}
 	    end;
 	{save, File} ->
-	    {ok, F2,_} = regexp:gsub(File, [92,92], "/"),
+	    F2 = re:replace(File, [92,92], "/", [global,{return,list}]),
 	    case gstk:call(["ed_save ",Editor," ",gstk:to_ascii(F2)]) of
 		{result,    _} -> none;
 		{bad_result,Re} -> 
diff --git a/lib/gs/src/gstk_generic.erl b/lib/gs/src/gstk_generic.erl
index 3ddb69efc5..2cc6c4c2d3 100644
--- a/lib/gs/src/gstk_generic.erl
+++ b/lib/gs/src/gstk_generic.erl
@@ -414,7 +414,7 @@ gen_font(_Opt,Gstkid,_TkW,DB,_ExtraArg) ->
 gen_label({text,Text},Opts,Gstkid,TkW,DB,ExtraArg,S,P,C) ->
     out_opts(Opts,Gstkid,TkW,DB,ExtraArg,[" -text ", gstk:to_ascii(Text), " -bi {}"|S],P,C);
 gen_label({image,Img},Opts,Gstkid,TkW,DB,ExtraArg,S,P,C) ->
-    {ok, I2,_} = regexp:gsub(Img, [92,92], "/"),
+    I2 = re:replace(Img, [92,92], "/", [global,{return,list}]),
     out_opts(Opts,Gstkid,TkW,DB,ExtraArg,[" -bi \"@", I2, "\" -text {}"|S],P,C).
 gen_label(_Opt,_Gstkid,TkW,_DB,_ExtraArg) ->
     case gstk:call([TkW, " cg -bit"]) of
diff --git a/lib/gs/src/gstk_image.erl b/lib/gs/src/gstk_image.erl
index 5ad37cf6de..9adbe42386 100644
--- a/lib/gs/src/gstk_image.erl
+++ b/lib/gs/src/gstk_image.erl
@@ -227,10 +227,10 @@ event(DB, Gstkid, Etype, Edata, Args) ->
 option(Option, Gstkid, _Canvas, _DB, _AItem) ->
     case Option of
 	{bitmap,     Bitmap} ->
-	    {ok, BF,_} = regexp:gsub(Bitmap, [92,92], "/"),
+	    BF = re:replace(Bitmap, [92,92], "/", [global,{return,list}]),
 	    {s, [" -bi @", BF]};
 	{load_gif,       File} -> 
-	    {ok, F2,_} = regexp:gsub(File, [92,92], "/"),
+	    F2 = re:replace(File, [92,92], "/", [global,{return,list}]),
 	    {Photo_item, _item} = Gstkid#gstkid.widget_data,
 	    {c,[Photo_item, " configure -file ", gstk:to_ascii(F2)]};
 	{pix_val,  {Coords,Color}} ->
diff --git a/lib/gs/src/tool_utils.erl b/lib/gs/src/tool_utils.erl
index b07e92c4f0..d09af5f22f 100644
--- a/lib/gs/src/tool_utils.erl
+++ b/lib/gs/src/tool_utils.erl
@@ -98,7 +98,8 @@ open_help_default(Parent, File) ->
                                _Else -> "netscape -remote \"openURL(file:" ++ File ++ ")\""
 			  end;
 		      {win32,_AnyType} ->
-			  "netscape.exe -h " ++ regexp:gsub(File,"\\\\","/");
+			  "netscape.exe -h " ++
+			      re:replace(File,"\\\\","/",[global,{return,list}]);
 		      _Other ->
 			  unknown
 		  end;
-- 
cgit v1.2.3


From b22894a3b82675d88b06428fe38eceeef8ca3870 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 25 Aug 2011 14:02:43 +0200
Subject: tv: Eliminate use of deprecated regexp module

---
 lib/tv/src/tv_db_search.erl | 32 +++++---------------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

(limited to 'lib')

diff --git a/lib/tv/src/tv_db_search.erl b/lib/tv/src/tv_db_search.erl
index edd3c188e2..7634bc63b6 100644
--- a/lib/tv/src/tv_db_search.erl
+++ b/lib/tv/src/tv_db_search.erl
@@ -244,10 +244,10 @@ get_entry_text() ->
 
 
 string_to_regexp(Str) ->
-    case regexp:parse(Str) of
+    case re:compile(Str) of
 	{ok, RegExp} ->
 	    {ok, RegExp};
-	_Error ->
+	{error, _Error} ->
 	    case get(error_msg_mode) of
 		normal ->
 		    {error, {not_a_regexp, "Please enter a regular expression!"}};
@@ -410,33 +410,11 @@ search_for_regexp(Pattern, Elem, ListAsStr) ->
 		lists:flatten(tv_io_lib:write(Elem))
 	end,
 
-    case regexp:first_match(ListToSearch, Pattern) of
-	{match, _, _} ->
+    case re:run(ListToSearch, Pattern, [{capture,none}]) of
+	match ->
 	    found;
-	_Other ->
+	nomatch ->
 	    not_found
-	    %% The code below shall be used instead if it is desired to 
-	    %% compare each *element* in the tuples to the regular expression,
-	    %% i.e., treat each element as a new line/string.
-	    %% The difference is most easily explained through an example:
-	    %% If we treat each tuple as a new line/string, the regular expression
-	    %% "^{win" will match the string "{win, 1, 2, 3}", but not the string 
-	    %% "{1, {win,2}}".
-	    %% If we treat each element as a new line/string, the RE "^{win" will match
-	    %% both strings above.
-    
-	    %% SearchList = tuple_to_list(Elem),
-	    %% case lists:dropwhile(
-	    %%	   fun(H) ->
-	    %%		   nomatch == regexp:first_match(lists:flatten(io_lib:write(H)), 
-	    %%						 Pattern)
-	    %%	   end,
-	    %%	   SearchList) of
-	    %%	[] ->
-	    %%	    not_found;
-	    %%	_AnyList ->
-	    %%	    found
-	    %% end
     end.
 
 
-- 
cgit v1.2.3


From b5599c98a4e38c029b1cf00f46a2323c83f59f1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 26 Aug 2011 09:08:52 +0200
Subject: appmon: Eliminate use of deprecated regexp module

---
 lib/appmon/src/appmon_web.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'lib')

diff --git a/lib/appmon/src/appmon_web.erl b/lib/appmon/src/appmon_web.erl
index fb7144246c..7c0451c3c3 100644
--- a/lib/appmon/src/appmon_web.erl
+++ b/lib/appmon/src/appmon_web.erl
@@ -578,9 +578,9 @@ htmlify_pid([],New)->
 %% the HTTP protocol                                                  %%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 urlify_pid(Pid) ->
-    case regexp:first_match(Pid,"[<].*[>]") of
-	{match,Start,Len}->
-	    "%3C"++string:substr(Pid,Start+1,Len-2)++"%3E";
+    case re:run(Pid,"[<](.*)[>]",[{capture,all_but_first,list}]) of
+	{match,[PidStr]}->
+	    "%3C"++PidStr++"%3E";
 	_->
 	    Pid
     end.
-- 
cgit v1.2.3


From 043335119b1625d04d87c33851749a9f742b024a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 9 Aug 2011 10:40:37 +0200
Subject: xmerl test suite: Eliminate use of deprecated regexp module

---
 lib/xmerl/test/xmerl_test_lib.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'lib')

diff --git a/lib/xmerl/test/xmerl_test_lib.erl b/lib/xmerl/test/xmerl_test_lib.erl
index a83956c076..e82ad283b2 100644
--- a/lib/xmerl/test/xmerl_test_lib.erl
+++ b/lib/xmerl/test/xmerl_test_lib.erl
@@ -87,6 +87,6 @@ keysearch_delete(Key,N,List) ->
 %% the original data directory.
 
 get_data_dir(Config) ->
-    Data0 = ?config(data_dir, Config),
-    {ok,Data,_} = regexp:sub(Data0, "xmerl_sax_std_SUITE", "xmerl_std_SUITE"),
-    Data.
+    Data = ?config(data_dir, Config),
+    Opts = [{return,list}],
+    re:replace(Data, "xmerl_sax_std_SUITE", "xmerl_std_SUITE", Opts).
-- 
cgit v1.2.3


From f772969e11e114e2060730cb618b7b528bfc5172 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 9 Aug 2011 11:10:20 +0200
Subject: tools test suite: Eliminate use of deprecated regexp module

Also extend the test suite so that the changed code will be
executed.
---
 lib/tools/test/eprof_SUITE_data/ed.script |  2 ++
 lib/tools/test/eprof_SUITE_data/eed.erl   | 39 +++++++++++++++++--------------
 2 files changed, 23 insertions(+), 18 deletions(-)

(limited to 'lib')

diff --git a/lib/tools/test/eprof_SUITE_data/ed.script b/lib/tools/test/eprof_SUITE_data/ed.script
index 94531a9e98..fe1625bc50 100644
--- a/lib/tools/test/eprof_SUITE_data/ed.script
+++ b/lib/tools/test/eprof_SUITE_data/ed.script
@@ -1,5 +1,7 @@
 H
 r eed.erl
+1,$s/Created :/Skapad  :/p
+/^cmd_line/,/^file/-1p
 g/^[a-z][a-zA-Z_]*\(/i\
 %%% -------------------------------------------------------------\
 %%% A stupid function header.\
diff --git a/lib/tools/test/eprof_SUITE_data/eed.erl b/lib/tools/test/eprof_SUITE_data/eed.erl
index 0175abdd0e..75524a4f2c 100644
--- a/lib/tools/test/eprof_SUITE_data/eed.erl
+++ b/lib/tools/test/eprof_SUITE_data/eed.erl
@@ -238,8 +238,8 @@ scan_forward(End, Patt0, State) ->
     scan_forward1(Dot+1, After, NewState, Rest).
 
 scan_forward1(Linenum, [Line|Rest], State, RestCmd) ->
-    case regexp:first_match(Line#line.contents, State#state.pattern) of
-	{match, _, _} ->
+    case re:run(Line#line.contents, State#state.pattern, [{capture, none}]) of
+	match ->
 	    {ok, Linenum, RestCmd, State};
 	nomatch ->
 	    scan_forward1(Linenum+1, Rest, State, RestCmd)
@@ -259,8 +259,9 @@ scan_forward2(0, [], State, RestCmd) ->
 scan_forward2(Linenum, [Line|Rest], State, RestCmd) ->
     case scan_forward2(Linenum-1, Rest, State, RestCmd) of
 	false ->
-	    case regexp:first_match(Line#line.contents, State#state.pattern) of
-		{match, _, _} ->
+	    case re:run(Line#line.contents, State#state.pattern,
+			[{capture, none}]) of
+		match ->
 		    {ok, Linenum, RestCmd, State};
 		nomatch ->
 		    false
@@ -612,9 +613,10 @@ subst_command([Sep|Cmd0], [First, Last], St0) ->
     St1 = save_for_undo(St0),
     {ok, Cmd1, St2} = get_pattern(Sep, Cmd0, St1),
     {ok, Replacement, Cmd2} = get_replacement(Sep, Cmd1),
-    {ok, Sub, Cmd3} = subst_check_gflag(Cmd2),
+    {ok, Opts, Cmd3} = subst_check_gflag(Cmd2),
     St3 = check_trailing_p(Cmd3, St2),
-    subst_command(Last-First+1, Sub, Replacement, move_to(First-1, St3), nomatch);
+    subst_command(Last-First+1, Opts, Replacement,
+		  move_to(First-1, St3), nomatch);
 subst_command([], _, _) ->
     error(bad_delimiter).
     
@@ -622,21 +624,22 @@ subst_command(0, _, _, _, nomatch) ->
     error(nomatch);
 subst_command(0, _, _, _, StLast) when record(StLast, state) ->
     StLast;
-subst_command(Left, Sub, Repl, St0, LastMatch) ->
+subst_command(Left, Opts, Repl, St0, LastMatch) ->
     St1 = next_line(St0),
     [Line|_] = St1#state.upto_dot,
-    case regexp:Sub(Line#line.contents, St1#state.pattern, Repl) of
-	{ok, _, 0} ->
-	    subst_command(Left-1, Sub, Repl, St1, LastMatch);
-	{ok, NewContents, _} ->
+    Contents = Line#line.contents,
+    case re:replace(Contents, St1#state.pattern, Repl, Opts) of
+	Contents ->
+	    subst_command(Left-1, Opts, Repl, St1, LastMatch);
+	NewContents ->
 	    %% XXX This doesn't work with marks.
 	    St2 = delete_current_line(St1),
 	    St3 = insert_line(NewContents, St2),
-	    subst_command(Left-1, Sub, Repl, St3, St3)
+	    subst_command(Left-1, Opts, Repl, St3, St3)
     end.
 
-subst_check_gflag([$g|Cmd]) -> {ok, gsub, Cmd};
-subst_check_gflag(Cmd)      -> {ok, sub, Cmd}.
+subst_check_gflag([$g|Cmd]) -> {ok, [global,{return,list}], Cmd};
+subst_check_gflag(Cmd)      -> {ok, [{return,list}], Cmd}.
 
 %% u - undo
 
@@ -721,7 +724,7 @@ get_pattern(End, Cmd, State) ->
 get_pattern(End, [End|Rest], State, []) when State#state.pattern /= undefined ->
     {ok, Rest, State};
 get_pattern(End, [End|Rest], State, Result) ->
-    case regexp:parse(lists:reverse(Result)) of
+    case re:compile(lists:reverse(Result)) of
 	{error, _} ->
 	    error(bad_pattern);
 	{ok, Re} ->
@@ -765,9 +768,9 @@ match(State) when State#state.dot == 0 ->
 match(State) ->
     [Line|_] = State#state.upto_dot,
     Re = State#state.pattern,
-    case regexp:first_match(Line#line.contents, Re) of
-	{match, _, _} -> true;
-	nomatch       -> false
+    case re:run(Line#line.contents, Re, [{capture, none}]) of
+	match   -> true;
+	nomatch -> false
     end.
 
 skip_blanks([$ |Rest]) ->
-- 
cgit v1.2.3


From 3077842ea7098c51b0b0e5b4fad88fbe5e8e29a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 9 Aug 2011 11:21:57 +0200
Subject: tools test suite: Eliminate compilation warnings for the eed module

---
 lib/tools/test/eprof_SUITE_data/eed.erl | 52 +++++++++++++++++----------------
 1 file changed, 27 insertions(+), 25 deletions(-)

(limited to 'lib')

diff --git a/lib/tools/test/eprof_SUITE_data/eed.erl b/lib/tools/test/eprof_SUITE_data/eed.erl
index 75524a4f2c..520c5f3dd1 100644
--- a/lib/tools/test/eprof_SUITE_data/eed.erl
+++ b/lib/tools/test/eprof_SUITE_data/eed.erl
@@ -10,6 +10,8 @@
 
 -export([edit/0, edit/1, file/1, cmd_line/1]).
 
+-compile({no_auto_import,[error/1]}).
+
 -record(state, {dot = 0,			% Line number of dot.
 		upto_dot = [],			% Lines up to dot (reversed).
 		after_dot = [],			% Lines after dot.
@@ -60,7 +62,7 @@ loop(St0) ->
 	    ok;
 	{error, Reason} ->
 	    loop(print_error(Reason, St1));
-	St2 when record(St2, state) ->
+	St2 when is_record(St2, state) ->
 	    loop(St2)
     end.
 
@@ -68,7 +70,7 @@ command(Cmd, St) ->
     case parse_command(Cmd, St) of
 	quit ->
 	    quit;
-	St1 when function(St1#state.print) ->
+	St1 when is_function(St1#state.print) ->
 	    if
 		St1#state.dot /= 0 ->
 		    print_current(St1);
@@ -76,7 +78,7 @@ command(Cmd, St) ->
 		    ok
 	    end,
 	    St1#state{print=false};
-	St1 when record(St1, state) ->
+	St1 when is_record(St1, state) ->
 	    St1
     end.
 
@@ -103,13 +105,13 @@ get_input([C|Rest], St, Result) ->
 get_line1(Io, Prompt, Result) ->
     get_line2(Io, io:get_line(Io, Prompt), Result).
 
-get_line2(Io, eof, []) ->
+get_line2(_Io, eof, []) ->
     eof;
-get_line2(Io, eof, Result) ->
+get_line2(_Io, eof, Result) ->
     lists:reverse(Result);
 get_line2(Io, [$\\, $\n], Result) ->
     get_line1(Io, '', [$\n|Result]);
-get_line2(Io, [$\n], Result) ->
+get_line2(_Io, [$\n], Result) ->
     lists:reverse(Result, [$\n]);
 get_line2(Io, [C|Rest], Result) ->
     get_line2(Io, Rest, [C|Result]).
@@ -193,7 +195,7 @@ get_one1([$+|Rest], Sum, St) ->
     get_one2({ok, 1, Rest}, 1, Sum, St);
 get_one1([$-|Rest], Sum, St) ->
     get_one2({ok, 1, Rest}, -1, Sum, St);
-get_one1(Cmd, false, St) ->
+get_one1(_Cmd, false, _St) ->
     false;
 get_one1(Cmd, Sum, St) ->
     {ok, Sum, Cmd, St}.
@@ -222,13 +224,13 @@ get_address([$', Mark|Rest], St) when $a =< Mark, Mark =< $z ->
 	false ->
 	    {ok, 0, Rest, St}
     end;
-get_address([$'|Rest], State) ->
+get_address([$'|_Rest], _State) ->
     error(bad_mark);
 get_address([$/|Rest], State) ->
     scan_forward($/, Rest, State);
-get_address([$?|Rest], State) ->
+get_address([$?|_Rest], _State) ->
     error(not_implemented);
-get_address(Cmd, St) ->
+get_address(_Cmd, _St) ->
     false.
 
 scan_forward(End, Patt0, State) ->
@@ -254,7 +256,7 @@ scan_forward1(_, [], State, RestCmd) ->
 	    Other
     end.
 
-scan_forward2(0, [], State, RestCmd) ->
+scan_forward2(0, [], _State, _RestCmd) ->
     false;
 scan_forward2(Linenum, [Line|Rest], State, RestCmd) ->
     case scan_forward2(Linenum-1, Rest, State, RestCmd) of
@@ -297,7 +299,7 @@ parse_cmd_char($t, Cont) -> Cont(fun transpose_command/3, 2, dot);
 parse_cmd_char($u, Cont) -> Cont(fun undo_command/3, 0, none);
 parse_cmd_char($v, Cont) -> Cont(fun vglobal_command/3, 2, all);
 parse_cmd_char($w, Cont) -> Cont(fun write_command/3, 2, all);
-parse_cmd_char(_, Cont)  -> error(bad_command).
+parse_cmd_char(_, _Cont)  -> error(bad_command).
 
 execute_command(Fun, NumLines, Def, State, Nums, Rest) ->
     Lines = check_lines(NumLines, Def, Nums, State),
@@ -381,7 +383,7 @@ change_command(Rest, Lines, St0) ->
 
 %% (.,.)d - delete lines
 
-delete_command(Rest, [0, Last], St) ->
+delete_command(_Rest, [0, _Last], _St) ->
     error(bad_linenum);
 delete_command(Rest, [First, Last], St0) ->
     St1 = check_trailing_p(Rest, save_for_undo(St0)),
@@ -397,7 +399,7 @@ delete(Left, St0) ->
 
 %% e file - replace buffer with new file
 
-enter_command(Name, [], St) when St#state.modified == true ->
+enter_command(_Name, [], St) when St#state.modified == true ->
     error(buffer_modified);
 enter_command(Name, [], St0) ->
     enter_always_command(Name, [], St0).
@@ -440,7 +442,7 @@ mark(Sense, [First, Last], St0) ->
     St1 = move_to(Last, St0),
     mark1(Sense, First-1, St1).
 
-mark1(Sense, First, St) when St#state.dot == First ->
+mark1(_Sense, First, St) when St#state.dot == First ->
     St;
 mark1(Sense, First, St) ->
     [Line|Prev] = St#state.upto_dot,
@@ -508,16 +510,16 @@ help_always_command([], [], St) ->
 
 %% (.)i - insert text
 
-insert_command(Rest, [0], State) ->
+insert_command(_Rest, [0], _State) ->
     error(bad_linenum);
 insert_command(Rest, [Line], State) ->
     append_command(Rest, [Line-1], State).
 
 %% (.)kx - mark line
 
-mark_command(_, [0], St) ->
+mark_command(_, [0], _St) ->
     error(bad_linenum);
-mark_command([Mark|Rest], [Line], St) when $a =< Mark, Mark =< $z ->
+mark_command([Mark|_Rest], [_Line], _St) when $a =< Mark, Mark =< $z ->
     error(not_implemented);
 mark_command(_, _, _) ->
     error(bad_mark).
@@ -529,12 +531,12 @@ list_command(Rest, Lines, St) ->
 
 %% (.,.)m - move lines
 
-move_command(Cmd, [First, Last], St) ->
+move_command(_Cmd, [_First, _Last], _St) ->
     error(not_implemented).
 
 %% (.,.)t - copy lines
 
-transpose_command(Cmd, [First, Last], St) ->
+transpose_command(_Cmd, [_First, _Last], _St) ->
     error(not_implemented).
 
 %% (.,.)n - print lines with line numbers
@@ -605,9 +607,9 @@ read(After, Name, St0) ->
 
 subst_command(_, [0, _], _) ->
     error(bad_linenum);
-subst_command([$ |Cmd0], [First, Last], St0) ->
+subst_command([$ |_Cmd0], [_First, _Last], _St0) ->
     error(bad_delimiter);
-subst_command([$\n|Cmd0], [First, Last], St0) ->
+subst_command([$\n|_Cmd0], [_First, _Last], _St0) ->
     error(bad_delimiter);
 subst_command([Sep|Cmd0], [First, Last], St0) ->
     St1 = save_for_undo(St0),
@@ -622,7 +624,7 @@ subst_command([], _, _) ->
     
 subst_command(0, _, _, _, nomatch) ->
     error(nomatch);
-subst_command(0, _, _, _, StLast) when record(StLast, state) ->
+subst_command(0, _, _, _, StLast) when is_record(StLast, state) ->
     StLast;
 subst_command(Left, Opts, Repl, St0, LastMatch) ->
     St1 = next_line(St0),
@@ -652,7 +654,7 @@ undo_command(_, _, _) ->
 
 %% (1,$)w - write buffer to file
 
-write_command(Cmd, [First, Last], St) ->
+write_command(_Cmd, [_First, _Last], _St) ->
     error(not_implemented).
     
 
@@ -757,7 +759,7 @@ check_trailing_p([$p], St) ->
     St#state{print=fun(Line, _) -> io:put_chars(Line) end};
 check_trailing_p([], State) ->
     State;
-check_trailing_p(Other, State) ->
+check_trailing_p(_Other, _State) ->
     error(garbage_after_command).
 
 error(Reason) ->
-- 
cgit v1.2.3


From 69542150b2863a2b715e03682539ec68402cb0ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 26 Aug 2011 10:09:27 +0200
Subject: erl_interface tests: Eliminate use of deprecated regexp module

---
 lib/erl_interface/test/all_SUITE_data/init_tc.erl | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

(limited to 'lib')

diff --git a/lib/erl_interface/test/all_SUITE_data/init_tc.erl b/lib/erl_interface/test/all_SUITE_data/init_tc.erl
index 8157d590fc..8db4667bf9 100644
--- a/lib/erl_interface/test/all_SUITE_data/init_tc.erl
+++ b/lib/erl_interface/test/all_SUITE_data/init_tc.erl
@@ -40,23 +40,11 @@ run([]) ->
 run1(Name) ->
     CFile = Name ++ ".c",
     {ok, Bin} = file:read_file(CFile),
-    String = binary_to_list(Bin),
-
-    %% This ConstPart stuff is because you can't retrieve part of a match.
-    %% Long live Perl!  
-    
-    ConstPart = "\nTESTCASE\\(",
-    ConstPartLen = 10,
-    {match, Matches} = regexp:matches(String, ConstPart++"[_a-zA-Z]*"),
-    Cases = get_names(Matches, ConstPartLen, Bin, []),
+    RE = "\nTESTCASE\\(([_a-zA-Z]*)\\)",
+    {match, Cases0} = re:run(Bin, RE, [{capture,all_but_first,list},global]),
+    Cases = lists:concat(Cases0),
     generate(Name, Cases).
 
-get_names([{Start, Length}|Rest], Skip, Bin, Result) ->
-    Name = binary_to_list(Bin, Start+Skip, Start+Length-1),
-    get_names(Rest, Skip, Bin, [Name|Result]);
-get_names([], _Skip, _Bin, Result) ->
-    lists:reverse(Result).
-
 generate(TcName, Cases) ->
     Hrl = TcName ++ "_cases.hrl",
     {ok, HrlFile} = file:open(Hrl, write),
-- 
cgit v1.2.3


From 3e8720728abe875683ad54fa4d93ba83df609f57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 26 Oct 2011 15:37:43 +0200
Subject: erl_tidy: Eliminate two references to 'regexp' in the documentation

---
 lib/syntax_tools/src/erl_tidy.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'lib')

diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl
index 1cfdc7234a..09efc9c392 100644
--- a/lib/syntax_tools/src/erl_tidy.erl
+++ b/lib/syntax_tools/src/erl_tidy.erl
@@ -103,7 +103,7 @@ dir(Dir) ->
 %%   <dt>{regexp, string()}</dt>
 %%
 %%       <dd>The value denotes a regular expression (see module
-%%       `regexp').  Tidying will only be applied to those
+%%       `re').  Tidying will only be applied to those
 %%       regular files whose names match this pattern. The default
 %%       value is `".*\\.erl$"', which matches normal
 %%       Erlang source file names.</dd>
@@ -124,7 +124,7 @@ dir(Dir) ->
 %%
 %% See the function {@link file/2} for further options.
 %%
-%% @see //stdlib/regexp
+%% @see //stdlib/re
 %% @see file/2
 
 -record(dir, {follow_links = false :: boolean(),
-- 
cgit v1.2.3