You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by bu...@apache.org on 2005/08/17 16:23:39 UTC

DO NOT REPLY [Bug 36229] New: - regex makes incorrect pattern match if multiple matches on a line

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36229>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36229

           Summary: regex makes incorrect pattern match if multiple matches
                    on a line
           Product: JMeter
           Version: 2.0.3
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
        AssignedTo: jmeter-dev@jakarta.apache.org
        ReportedBy: craiglaurent@yahoo.com


Using the Regular Expression Extractor against and HTML page it makes an
incorrect pattern match if there are multiple matches on the same line.

It appears that for a given line, it is getting the firstIndex of the first
part; and the lastIndex of the last part....when it should be getting the
firstIndex of the last part; starting at the firstIndex + length of first part.

simply, if it is looking for a(.+)c; and the data contains xabcyabcz, it returns
one entry "bcyab" rather than two entries "b" and "b".
A workaround would be to search for xa(.+)cy or ya(.+)cz, which would result in
a unique match.
 
E.g.  A more practical example follows.
If the regex is setup as:
  documentID='(.+)'
and a line looks like this:
  To view the document, <a href="url?documentID='123'">click here&nbsp;</a><a
href="url?documentID='123'"><img ...></a>
the resulting pattern match stored in the variable is a single entry of:
  123'">click here&nbsp;</a><a href="url?documentID='123
when it should return two entries:
  123 and 123.

We found that we could workaround, and specify everything, so that it would find
a unique match...but that is just a hack to workaround the bug.  This is
simplified html...obviously this html could be changed to use a single anchor tag.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org