The RegularExpression 'matches' function no longer returns the start and end 
position of a match
------------------------------------------------------------------------------------------------

                 Key: XERCESC-1910
                 URL: https://issues.apache.org/jira/browse/XERCESC-1910
             Project: Xerces-C++
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 3.0.1
         Environment: Windows
            Reporter: Steve Roberts


We have recently upgraded from version 2.2.0 to version 3.0.1. Between these 
versions a change was made to the RegularExpression::matchUnion function, so 
that it now uses a local version of the context structure. The result of this 
is that the 'fMatch' member of the context can be changed from its original 
instance. Therefore, back in the RegularExpression::matches function, just 
before it returns, it sets the start and end position of the match:

            context.fMatch->setStartPos(0, (int)matchStart);
            context.fMatch->setEndPos(0, matchEnd);

However, the 'fMatch' object no longer matches the one that was passed through 
to function (due to what happened in 'matchUnion') and therefore these values 
don't get returned to the calling function.
Therefore, I think that in the 'matches' function is should actually be setting 
the start and end position of the 'pMatch' property that is passed into the 
function, rather than the 'context.fMatch'.

The code we are using to call the regular expression is this:

  XERCES_CPP_NAMESPACE::RegularExpression re(expression.c_str());
  if( re.matches( text, &match ) )
  { ...

where expression = "([\-\(]?\d{1,3}([, 
]\d{3})+\.\d+[\)]?|[\-\(]?\d+\.\d+[\)]?).*"
and text = "13.13"


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to