Split String using the regular expression Pattern. Splits
is a list of strings holding alternating matches of Pattern
and skipped parts of the String, starting with a skipped
part. The Splits lists ends with a string of the content of String
after the last match. If
Pattern does not appear in String, Splits
is a list holding a copy of String. This implies the number
of elements in Splits is always odd. For example:
?- re_split("a+", "abaac", Splits, ).
Splits = ["","a","b","aa","c"].
?- re_split(":\\s*"/n, "Age: 33", Splits, ).
Splits = ['Age', ': ', 33].
|Pattern ||is the pattern text, optionally
follows by /Flags. Similar to re_matchsub/4,
the final output type can be controlled by a flag |
(string, default) or
n (number if possible, atom