strMatches fails with multi-line string
Bug #612596 reported by
James Shepherd
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
TestPlan |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I would expect the following .test to output "Notice: et even more"
set %Text% <<EOF
Line: Value
More: And More
Yet even more
EOF
if strMatches %Text% Y(.*)
Notice %Return:Group:1%
else
Notice FAIL
end
But it outputs "Notice: FAIL"
It looks like strMatches doesn't work with multi-line strings.
To post a comment you must log in.
strMatches is a complete string match, even in the multi-line case. Thus your check for matching should be expected to fail.
You can however use the "strContains" function which should do what you want. Though you may want to also match beginning of line/end-of-line:
if strContains %Text% ^Y(.*)$
Notice %Return:Group:0%
else
Notice FAIL
end
Be aware that <<EOF preserves leading space on the lines, so Y must be the first character here. Also, I've output group 0 instead of 1, since group 1 is the string "et even more".