It is often necessary to split a string into pieces
based on several different (potentially multi-character) separator strings,
while still retaining the information about which separators were present in the input.

This is particularly useful when doing small parsing tasks. 

The task is to write code to demonstrate this.

The function (or procedure or method, as appropriate) should
take an input string and an ordered collection of separators.

The order of the separators is significant: 

The delimiter order represents priority in matching, with the first defined delimiter having the highest priority.
In cases where there would be an ambiguity as to
which separator to use at a particular point
(e.g., because one separator is a prefix of another)
the separator with the highest priority should be used.
Delimiters can be reused and the output from the function should be an ordered sequence of substrings.

Test your code using the input string “a!===b=!=c” and the separators “==”, “!=” and “=”.

For these inputs the string should be parsed as "a" (!=) "" (==) "b" (=) "" (!=) "c", where matched delimiters are shown in parentheses, and separated strings are quoted, so our resulting output is "a", empty string, "b", empty string, "c".
Note that the quotation marks are shown for clarity and do not form part of the output.

Extra Credit: provide information that indicates which separator was matched at each separation point and where in the input string that separator was matched.

/*REXX program  splits  a (character) string  based on different  separator  delimiters.*/
parse arg $                                      /*obtain optional string from the C.L. */
if $=''   then $= "a!===b=!=c"                   /*None specified?  Then use the default*/
say 'old string:' $                              /*display the old string to the screen.*/
null= '0'x                                       /*null char.   It can be most anything.*/
seps= '== != ='                                  /*list of separator strings to be used.*/
                                                 /* [↓]   process the tokens in  SEPS.  */
  do j=1  for words(seps)                        /*parse the string with all the seps.  */
  sep=word(seps,j)                               /*pick a separator to use in below code*/
                                                 /* [↓]   process characters in the sep.*/
        do k=1  for length(sep)                  /*parse for various separator versions.*/
        sep=strip(insert(null, sep, k), , null)  /*allow imbedded "nulls" in separator, */
        $=changestr(sep, $, null)                /*       ··· but not trailing "nulls". */
                                                 /* [↓]   process strings in the input. */
             do  until $==old;      old=$        /*keep changing until no more changes. */
             $=changestr(null || null, $, null)  /*reduce replicated "nulls" in string. */
             end   /*until*/
                                                 /* [↓]  use  BIF  or  external program.*/
        sep=changestr(null, sep, '')             /*remove true nulls from the separator.*/
        end        /*k*/
  end              /*j*/
 
showNull= ' {} '                                 /*just one more thing, display the ··· */
$=changestr(null, $, showNull)                   /*        ··· showing of "null" chars. */
say 'new string:' $                              /*now, display the new string to term. */
                                                 /*stick a fork in it,  we're all done. */