From the NannyMUD documentation
2004-12-26
NAME
regexplode - Explode a string on a regular expression.SYNTAX
string *regexplode(string str, string pattern)DESCRIPTION
This function splits a string into an array. It takes the given string, and divides it into parts separated by the given pattern. It is also reversible; using regexplode() to split a string, and implode() to re-assemble it, will give you the original string.EXAMPLE
regexplode("abc", ".") gives ({"","a","","b","","c",""})EXAMPLE
string string_1, string_2, *arr; string_1 = "abcdef"; arr = regexplode(string_1, ""); string_2 = implode(arr, ""); // string_1 and string_2 are now equal.EXAMPLE
// Splitting a string into an array with the letters as its // elements: string *letter_array(string input) { return regexplode(the_string, "") - ({ "" }); } // letter_arrayEXAMPLE
// Replacing all multiple spaces with a single space: string collapse_multiple_space(string input) { string *parts; parts = regexplode(input, " "); return implode(parts, " "); }EXAMPLE
// Make a table with letters in columns: void *make_table() { string letters, *parts; letters = "abcdefghijkl"; parts = regexplode(letters, "") - ({ "" }); write(sprintf("%-*#s\n",10,implode(parts,"\n"))); }SEE ALSO
explode in efun/type_related/explodeSEE ALSO
regexp in efun/special/regexpSEE ALSO
sscanf in efun/type_related/sscanf