You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Steve Roberts (JIRA)" <xe...@xml.apache.org> on 2010/02/05 18:39:27 UTC

[jira] Created: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


RE: [jira] Commented: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by Steve Roberts <st...@macro4.com>.
Hi Boris,

It's not that the functionality we used to use has been removed, rather
it no longer works and I think this is a bug.

The regular expression 'matches' function that we call takes a 'pMatch'
parameter. In the old version of Xerces that we had (2.2.0), this
structure would always return with 2 arrays being set that defined the
start and end positions in the input string at which the regular
expression had been matched. 

Now, in the latest version of Xerces, this isn't always true - sometimes
the values are set and sometimes they aren't. The reason for this is
that the values are set using a local 'context' variable, which
initially has a pointer set to the supplied 'pMatch' object - however,
in the new version of Xerces, this pointer can now later be set to an
other object, allocated in the 'matchUnion' function and so in this
case, the position of the regular expression match never gets returned
to the caller. (if you look at the end of the 'matches' function you'll
see that the start and end positions are set using the 'context' object,
but using this makes no sense, as its just about to go out of scope -
instead they should be set directly into the 'pMatch' object). When the
'matchUnion' function is not called, the pointer is still set to the
supplied 'pMatch' and in this case the positions are returned correctly.

Therefore I don't think that functionality has intentionally been
removed between the 2 versions, rather a change means that it no longer
works correctly.

Please find attached some changes I've made to fix the problem.

Regards,
Steve



-----Original Message-----
From: Boris Kolpackov (JIRA) [mailto:xerces-c-dev@xml.apache.org] 
Sent: 11 February 2010 12:30
To: c-dev@xerces.apache.org
Subject: [jira] Commented: (XERCESC-1910) The RegularExpression
'matches' function no longer returns the start and end position of a
match


    [
https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.ji
ra.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=128324
66#action_12832466 ] 

Boris Kolpackov commented on XERCESC-1910:
------------------------------------------

Steve, do I understand you correctly in that you are saying that certain
functionality (that you used to rely on) has been removed between the
two version as opposed to that there is a bug that affects the current
version?

> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


-
------------------------------------------------------------------------
This email has been scanned for all known viruses by the MessageLabs
Email
Security Service and the Macro 4 internal virus protection system.
.
------------------------------------------------------------------------

- ------------------------------------------------------------------------
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 internal virus protection system.
. ------------------------------------------------------------------------

[jira] Updated: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov updated XERCESC-1910:
-------------------------------------

    Fix Version/s: 3.1.0
                       (was: 3.2.0)
                       (was: 3.1.1)

> 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
>             Fix For: 3.1.0
>
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov updated XERCESC-1910:
-------------------------------------

    Fix Version/s: 3.2.0
                   3.1.1

Scheduling for 3.1.1 and 3.2.0. Proposed fix is in the c-dev archives.

> 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
>             Fix For: 3.1.1, 3.2.0
>
>
> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Closed: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov closed XERCESC-1910.
------------------------------------


Assuming this is fixed since 3.1.0.

> 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
>             Fix For: 3.1.0
>
>
> 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.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12832466#action_12832466 ] 

Boris Kolpackov commented on XERCESC-1910:
------------------------------------------

Steve, do I understand you correctly in that you are saying that certain functionality (that you used to rely on) has been removed between the two version as opposed to that there is a bug that affects the current version?

> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[jira] Resolved: (XERCESC-1910) The RegularExpression 'matches' function no longer returns the start and end position of a match

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-1910.
--------------------------------------

    Resolution: Duplicate

Duplicate of XERCESC-1870, that has been fixed in 3.1.0. Can you check that version if it works also for you?

Alberto

> 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
>             Fix For: 3.1.1, 3.2.0
>
>
> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org