Closed Uebix closed 5 years ago
Can you add a unit test, or give me a usage example and I will add the test.
Hello, an example may be when you have more than one character used to delimit tags: [,;>|]. This happen when you have different strings sources for tags like in a CSV file of products and you want combine the column tags that are separated with ";" and the column categories names that are separated with ">" or "|" and I want insert as tags. An other solution is to use optional parameter in functions like tag and retag, but i think that a regular expression is more complete and extend the possibilities of the developer.
A complete different example is if you want use your package such as a simple index system for text and not as tagging. You pass the text and set the regular expression for split words in a text without spaces or other characters so the delimiter may be /[^a-zA-Z0-9]+/.
I just wanted a line of code or two :)
Can't have multiple delimiters, because the delimiter field is use to write. You build the slug with it.
Added a backward compatible possibility to use a regular expression (so different characters or more complex rules) to split a string of tags.