ContainsCondition: regex does match to whole value only

Description

From the documentation

The Contains Condition can be used to check whether string, variable value or file content contains a given pattern.

The pattern can be a plain string or a regular expression.

So the condition should be true, if the value is a substring of the content. This works well with option regex="false". But with regex="true" the regular expression given in value has to match the whole content.

Example

In this example, the first condition will evaluate true, but the second one false.

Is this intented? I do not think so.

Environment

None

Activity

Show:
Tom Helpstone
May 19, 2016, 9:16 AM
Edited

Adding a prefix and a suffix to an user supplied regex pattern could have side effects (with line delimiters, ...)

So using Matcher.find() instead of Matcher.matches() will find substrings instead of whole strings.
Even this could break existing installers I would suggest to fix this behaviour, because "Contains" is clearly understood as a search for substrings.

Sent pull request 510.

René Krell
May 21, 2016, 11:37 PM

PR #510 merged.
Thank you.

Tom Helpstone
May 24, 2016, 9:56 AM

The boundaries ^ and $ did not work as supposed for multiline matches

Tom Helpstone
May 24, 2016, 9:58 AM

sent pull request 518 containing

  • a postfix for multiline matches

  • unit tests.

René Krell
May 30, 2016, 1:28 PM

Merged PR #518.

Thank you.

Fixed

Assignee

Tom Helpstone

Reporter

Tom Helpstone

Impact

None

Sprint

None

Fix versions

Affects versions

Priority

Medium
Configure