As per How to Use JMeter Assertions in Three Easy Steps article:
The Pattern can be either be:
- a “string” for “Equals” or “Substring” clauses
- a “Perl5-style” Regular Expression for “Contains” or “Matches” clauses
In case of Substring it should be pretty simple: just put the whole "pattern" into the "Patterns to test" field as it is and if response contains the pattern - the assertion will pass.
In case of Contains JMeter uses Perl5Matcher.contains() method under the hood so treats the "Pattern" as a regular expression. Therefore you will need to escape the special characters with the back slash like:
v1.Accounts.Accounts.UpdateAccount failed due to validation errors:[MobileNumber] The field MobileNumber must be a string or array type with a maximum length of '20'.
Just in case, when it comes to Perl-Compatible Regular Expressions you need to escape the following characters:
.^$*+?()[{|
characters outside character classes
^-]
characters inside character classes
Also keep in mind that Regular Expressions are very fragile so any extra space, new line, tabulation, whatever will break them so if above recommendations won't help please update your question with at least partial (better full) response and specify what part of it you need to check, it might be the case it is much better to go for XPath Assertion
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…