Problem description: There are a couple of issues with pattern parameter processing when creating a trigger through the "Create trigger" wizard in the list of items:
1 - if the pattern contains round brackets, then everything that is placed after the closing bracket is lost.
2 - if the pattern contains quotes (single, double) the quotes are not escaped. As result, if there is text after the quotes an error is retrieved when attempting to save the expression. Furthermore the pattern itself is not put into double quotes
Steps to reproduce:
- Create a host with an item with data type set to Log or Text
- Open the trigger creation wizard from the items list
- Enter a trigger name
- in the expression field write down an epression that contains opening+closing double quotes and text after them, for example: "abc" abc
- Add the expression and attempt to save the trigger
Result 1: the double quotes are not escaped, as result the following error is returned:
- change the expression of the trigger to something that contains round brackets, for example: gr(a|e)y jacket
- Add the expression and save the trigger.
- Open configuration of the trigger
Result 2: the part of the expression that was placed after the closing bracket is lost.
1 - string pattern in the expression should be automatically quoted
2 - if the expression contains double quotes, the escape character should be placed before them
3 - no part of the pattern should be lost, even if it contains round brackets.