diff options
author | Niclas Eklund <[email protected]> | 2011-01-20 12:14:36 +0100 |
---|---|---|
committer | Niclas Eklund <[email protected]> | 2011-01-20 12:14:36 +0100 |
commit | 0ef3320c556912b4d9f05f89ec47154eb2b5834a (patch) | |
tree | 6105bc92ce5bd5cb2dd56c0f71e7a92226e89576 /lib/stdlib/src/re.erl | |
parent | 1bff9d79218bcb3c44737cb2bfefac85c6f0322f (diff) | |
parent | 86413606615440a7951b4c62162e2bfb87aa158c (diff) | |
download | otp-0ef3320c556912b4d9f05f89ec47154eb2b5834a.tar.gz otp-0ef3320c556912b4d9f05f89ec47154eb2b5834a.tar.bz2 otp-0ef3320c556912b4d9f05f89ec47154eb2b5834a.zip |
Merge branch 'maint-r14' of super:otp into nick/ensure_ssh_dir_exists/OTP-9010
Diffstat (limited to 'lib/stdlib/src/re.erl')
-rw-r--r-- | lib/stdlib/src/re.erl | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl index 296a6b3d23..9642de17b4 100644 --- a/lib/stdlib/src/re.erl +++ b/lib/stdlib/src/re.erl @@ -208,29 +208,25 @@ replace(Subject,RE,Replacement,Options) -> process_repl_params(Options,iodata,false), FlatSubject = to_binary(Subject, Unicode), FlatReplacement = to_binary(Replacement, Unicode), - case do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt) of - {error,_Err} -> - throw(badre); - IoList -> - case Convert of - iodata -> - IoList; - binary -> - case Unicode of - false -> - iolist_to_binary(IoList); - true -> - unicode:characters_to_binary(IoList,unicode) - end; - list -> - case Unicode of - false -> - binary_to_list(iolist_to_binary(IoList)); - true -> - unicode:characters_to_list(IoList,unicode) - end - end - end + IoList = do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt), + case Convert of + iodata -> + IoList; + binary -> + case Unicode of + false -> + iolist_to_binary(IoList); + true -> + unicode:characters_to_binary(IoList,unicode) + end; + list -> + case Unicode of + false -> + binary_to_list(iolist_to_binary(IoList)); + true -> + unicode:characters_to_list(IoList,unicode) + end + end catch throw:badopt -> erlang:error(badarg,[Subject,RE,Replacement,Options]); |