| purpose | returns each item in the list split into separate strings according to the specified regular expression R |
|---|---|
| input | a selection of titles |
| suffix | flags: m for multiline mode, i for case-insensitive mode |
| parameter | R=The regular expression at which to split each title |
| output | the input titles split into separate items according to the specified regular expression R |
Learn more about how to use Filters
[[the band thethe are the best the]splitregexp[the]]The following results are returned:
["", " band ", "", " are ", " best ", ""]Where it might be expected that the results would be:
[" band ", " are ", " best "]The blank items mark the boundaries between matches. If they are not required they can be removed with the blank category of the is Operator: [[the band thethe are the best the]splitregexp[the]!is[blank]].
The reason that the blank items can be useful is that they allow search and replace operations to be constructed from a combination of the split Operator or splitregexp Operator and the join Operator. For example:
[[nobody, really; wants; to see -- all this \punctuation]splitregexp[,|;|-|\\]join[...]]Syntax errors in the regular expression will cause the filter to return an error message. For example:
[[the cat sat on the mat]splitregexp[\]]The splitregexp operator is intended to be used as described above. If the regexp contains capture groups those groups will be included into the output.
| ⚠Warning: Don't do it this way! | |
Somewhat more useful may be this code.
\procedure re() (colou?red)
\procedure str() Some coloured text
{{{ [<str>splitregexp<re>join[, ]] }}}