Details

      Description

      Compiling ejabberd with Erlang/OTP R13B complains 41 times:

      ./gen_mod.erl:176: Warning: regexp:gsub/3: the regexp module is deprecated
       (will be removed in R15A); use the re module instead
      
      ./gen_mod.erl:180: Warning: regexp:gsub/3: the regexp module is deprecated 
      (will be removed in R15A); use the re module instead
      
      ./acl.erl:226: Warning: regexp:first_match/2: the regexp module is deprecated 
      (will be removed in R15A); use the re module instead
      
      ./acl.erl:234: Warning: regexp:format_error/1: the regexp module is deprecated 
      (will be removed in R15A); use the re module instead
      
      ...
      

      The OTP module 're' is only available since R12B-4. So, this module can only be used in ejabberd in a new release when R12B-4 or newer is required, for example ejabberd 3.0.0 or higher.

      To help making the changes, see what are the regexp functions and the possible replacements:

      • regexp:first_match/2
        regexp:first_match(String, RegExp) -> {match, Start, Length} | nomatch | {error, errordesc()}
        
        re:run(String, RegExp, [{capture, none}]) -> match | nomatch
        the exception badarg is thrown if a compilation error occurs
      • regexp:match/2
        regexp:match(String, RegExp) -> {match, Start, Length} | nomatch | {error, errordesc()}
        
        re:run(String, RegExp, [{capture, none}]) -> match | nomatch
        the exception badarg is thrown if a compilation error occurs
      • regexp:format_error/1
        re:compile(RegExp) -> {ok, MP} | {error, {ErrString, Position}}
        re:run(String, MP, [{capture, none}]) -> match | nomatch
      • regexp:split/2
        regexp:split(String, RegExp) -> {ok, FieldList} | {error, errordesc()}
        
        re:split(String, RegExp, [{return, list}]) -> FieldList
      • regexp:sub/3
        regexp:sub(String, RegExp, New) -> {ok, NewString, RepCount} | {error, errordesc()}
        
        re:replace(String, RegExp, New, [{return, list}]) -> NewString
      • regexp:gsub/3
        regexp:gsub(String, RegExp, New) -> {ok, NewString, RepCount} | {error, errordesc()}
        
        re:replace(String, RegExp, New, [global, {return, list}]) -> NewString
      • regexp:sh_to_awk/1
        regexp:sh_to_awk(ShRegExp) -> AwkRegExp
        
        xmerl_regexp:sh_to_awk(ShRegExp) -> AwkRegExp

      In ejabberd 2.1.x, the practical solution is to write ejabberd_regexp, which will attempt to use RE, and otherwise will use REGEXP in verry old systems.

        Issue Links

          Activity

          Hide
          badlop Badlop added a comment -

          Committed in SVN r2582.

          Show
          badlop Badlop added a comment - Committed in SVN r2582.

            People

            • Assignee:
              badlop Badlop
              Reporter:
              badlop Badlop
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development