There is a set of templates for texts, the form " Your order is available at:% w {1,3}. Take away soon! ", Where% w {1,3} is "a set of words separated by one or more spaces". By "word" we mean a set of letters, numbers, and a number of special characters. {1,3} is a quantifier that works similarly to quantifiers in regulars. The task is to learn to define texts for minimal matching of similar patterns. It was decided to convert such patterns into regular expressions. Thus, from the above example, get a regular:
/^Ваш заказ доступен по адресу:\s(?:\s*[\w\d\,\.\!]+\s*){1,3}\.\sЗабирайте скорее!$/u
Naturally, such a regular schedule can cause problems in the form of catastrophic backtracking, but I don’t see a way to optimize it, given the fact that there can be any number of spaces between words. I would be grateful for any indication of my blindness :)