In RiveScript, wildcards (*, #, _), alternatives (that’s the “(this|that)” syntax with parenthesis), and arrays when wrapped in paranthesis like “(@colors)” all get captured as “stars” and you use the <star> tags to get them back. (on that array thing, you can use an array without parenthesis around it, like “+ i have a @colors *” and it won’t go into a <star> tag; <star1> in that case would be the *, not the color)
So in your original example, the “(like|love)” goes into <star1> and the * would be <star2> in this case.
Optionals (the square bracket version) are sort of like alternatives, except 1) they never get captured as a <star> tag, and 2) the user could *completely omit* them from their message.
If you used optionals in your example, like ” + i [like|love] the * color” then the following things would match:
* I love the red color
* I like the red color
* I the red color
In the last one, the “like|love” part is omitted entirely, but it would still match because the word is optional (hence the name).
Optionals were designed for the use case of like,
+ what is your [home|office|cell] phone number
- It is 555-1234.
So the user could say “what is your home phone number” or just “what is your phone number”. Without optionals existing, that trigger would’ve had to be written out like this instead:
+ what is your (home phone|office phone|cell phone|phone) number