Parsing regex with alternatives and optionals
问题 I'm building a chatbot subset of RiveScript and trying to build the pattern matching parser with regular expression. Which three regexes match the following three examples? ex1: I am * years old valid match: - "I am 24 years old" invalid match: - "I am years old" ex2: what color is [my|your|his|her] (bright red|blue|green|lemon chiffon) * valid matches: - "what color is lemon chiffon car" - "what color is my some random text till the end of string" ex3: [*] told me to say * valid matches: -