You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2014/07/04 12:54:34 UTC

[jira] [Created] (JENA-740) SPARQL replace

Andy Seaborne created JENA-740:
----------------------------------

             Summary: SPARQL replace
                 Key: JENA-740
                 URL: https://issues.apache.org/jira/browse/JENA-740
             Project: Apache Jena
          Issue Type: Improvement
          Components: ARQ
    Affects Versions: Jena 2.11.2
            Reporter: Andy Seaborne
            Priority: Minor


http://mail-archives.apache.org/mod_mbox/jena-users/201407.mbox/%3CCA%2BQ4Jn%3DqOS85yCPGexqX%2BLFkX4Dw8QSQmBLq2kT05%2Btvj0xksA%40mail.gmail.com%3E

{{replace("abc", ".*", "x")}} returns {{"xx"}} because it uses Java's Matcher.replaceAll - it's one match for the whole of "abc" (it's a greedy pattern) and one match for the trailing empty string. Java returns {{"x"}} for an empty string, and {{"xx"}} for any non-empty string in place of "abc". 

F&O calls out this case and makes it an error.

http://www.w3.org/TR/xpath-functions/#func-replace

{quote}
An error is raised \[err:FORX0003\] if the pattern matches a zero-length string, that is, if the expression fn:matches("", $pattern, $flags) returns true. It is not an error, however, if a captured substring is zero-length.
{quote}




--
This message was sent by Atlassian JIRA
(v6.2#6252)