[teiid-issues] [JBoss JIRA] (TEIID-3491) Add support for REGEXP_REPLACE

Tom Arnold (JIRA) issues at jboss.org
Thu May 28 23:15:04 EDT 2015


    [ https://issues.jboss.org/browse/TEIID-3491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072115#comment-13072115 ] 

Tom Arnold edited comment on TEIID-3491 at 5/28/15 11:14 PM:
-------------------------------------------------------------

Sent pull request. Implemented using Java's Pattern class, so anything valid for that can be used. One difference from most other implementations is that back-references in the replacement string are written like {{$1}} instead of {{\1}}.

http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

I implemented another variant which allows several flags to be set that modify how the match is performed. The supported flags are:
* {{i}} - case insensitive match
* {{g}} - global match (aka replace-all)
* {{m}} - multiline match; changes {{^}} and {{$}} to match line-beginning and line-end instead of source-beginning and source-end.

I did not attempt to implement any pushdown support for this but I can look into it if there is interest.

Edit: I forgot to mention that I added a cache for the compiled regex patterns similar to what was done for the number and date formats. The Pattern object is threadsafe. The cache key is the combination of the regex string and the flags used to compile the pattern.


was (Author: tom9729):
Sent pull request. Implemented using Java's Pattern class, so anything valid for that can be used. One difference from most other implementations is that back-references in the replacement string are written like {{$1}} instead of {{\1}}.

http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

I implemented another variant which allows several flags to be set that modify how the match is performed. The supported flags are:
* {{i}} - case insensitive match
* {{g}} - global match (aka replace-all)
* {{m}} - multiline match; changes {{^}} and {{$}} to match line-beginning and line-end instead of source-beginning and source-end.

I did not attempt to implement any pushdown support for this but I can look into it if there is interest.

> Add support for REGEXP_REPLACE
> ------------------------------
>
>                 Key: TEIID-3491
>                 URL: https://issues.jboss.org/browse/TEIID-3491
>             Project: Teiid
>          Issue Type: Feature Request
>          Components: Query Engine
>            Reporter: Tom Arnold
>            Assignee: Steven Hawkins
>
> Add support for REGEXP_REPLACE function like in Postgres.
> http://www.postgresql.org/docs/9.3/static/functions-string.html
> Pushdown version might be tricky.
>  * MySQL - No support.
>  * Postgres - Good.
>  * Oracle - Good, but "g" flag to replace all matches is set by positional params instead.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the teiid-issues mailing list