Merge branch 'gerrit/mad-hatter' into 'master'

Change-Id: Id4a51ee33442e636f15cd812128077315f6599c0
diff --git a/asterixdb/asterix-algebra/src/main/javacc/AQLPlusExtension.jj b/asterixdb/asterix-algebra/src/main/javacc/AQLPlusExtension.jj
index c3cfdb1..35e8ff0 100644
--- a/asterixdb/asterix-algebra/src/main/javacc/AQLPlusExtension.jj
+++ b/asterixdb/asterix-algebra/src/main/javacc/AQLPlusExtension.jj
@@ -106,30 +106,24 @@
 @new
 Clause MetaVariableClause() throws ParseException :
 {
-    MetaVariableClause mc = new MetaVariableClause();
-    VarIdentifier var = new VarIdentifier();
 }
 {
     <METAVARIABLECLAUSE>
     {
-      mc.setVar(var);
-      var.setValue(token.image);
-      return mc;
+      VarIdentifier var = new VarIdentifier(token.image);
+      return new MetaVariableClause(var);
     }
 }
 
 @new
 MetaVariableExpr MetaVariableRef() throws ParseException:
 {
-    MetaVariableExpr metaVarExp = new MetaVariableExpr();
-    VarIdentifier var = new VarIdentifier();
 }
 {
-      <METAVARIABLE>
+    <METAVARIABLE>
     {
-     metaVarExp.setVar(var);
-     var.setValue(token.image);
-     return metaVarExp;
+      VarIdentifier var = new VarIdentifier(token.image);
+      return new MetaVariableExpr(var);
     }
 }
 
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index ce1a354..8dd8d02 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -557,11 +557,20 @@
         SourceLocation sourceLoc = dd.getSourceLocation();
         String dataverseName = getActiveDataverse(dd.getDataverse());
         String datasetName = dd.getName().getValue();
+        String datasetFullyQualifiedName = dataverseName + "." + datasetName;
         DatasetType dsType = dd.getDatasetType();
         String itemTypeDataverseName = getActiveDataverse(dd.getItemTypeDataverse());
         String itemTypeName = dd.getItemTypeName().getValue();
-        String metaItemTypeDataverseName = getActiveDataverse(dd.getMetaItemTypeDataverse());
-        String metaItemTypeName = dd.getMetaItemTypeName().getValue();
+        String itemTypeFullyQualifiedName = itemTypeDataverseName + "." + itemTypeName;
+        String metaItemTypeDataverseName = null;
+        String metaItemTypeName = null;
+        String metaItemTypeFullyQualifiedName = null;
+        Identifier metaItemTypeId = dd.getMetaItemTypeName();
+        if (metaItemTypeId != null) {
+            metaItemTypeName = metaItemTypeId.getValue();
+            metaItemTypeDataverseName = getActiveDataverse(dd.getMetaItemTypeDataverse());
+            metaItemTypeFullyQualifiedName = metaItemTypeDataverseName + "." + metaItemTypeName;
+        }
         Identifier ngNameId = dd.getNodegroupName();
         String nodegroupName = ngNameId == null ? null : ngNameId.getValue();
         String compactionPolicy = dd.getCompactionPolicy();
@@ -573,12 +582,12 @@
         boolean bActiveTxn = true;
         metadataProvider.setMetadataTxnContext(mdTxnCtx);
         MetadataLockUtil.createDatasetBegin(lockManager, metadataProvider.getLocks(), dataverseName,
-                itemTypeDataverseName, itemTypeDataverseName + "." + itemTypeName, metaItemTypeDataverseName,
-                metaItemTypeDataverseName + "." + metaItemTypeName, nodegroupName, compactionPolicy,
-                dataverseName + "." + datasetName, defaultCompactionPolicy);
+                itemTypeDataverseName, itemTypeFullyQualifiedName, metaItemTypeDataverseName,
+                metaItemTypeFullyQualifiedName, nodegroupName, compactionPolicy, datasetFullyQualifiedName,
+                defaultCompactionPolicy);
         Dataset dataset = null;
         try {
-            IDatasetDetails datasetDetails = null;
+            IDatasetDetails datasetDetails;
             Dataset ds = metadataProvider.findDataset(dataverseName, datasetName);
             if (ds != null) {
                 if (dd.getIfNotExists()) {
@@ -1372,8 +1381,8 @@
                 }
             }
 
-            if (activeDataverse != null && activeDataverse.getDataverseName() == dataverseName) {
-                activeDataverse = null;
+            if (activeDataverse.getDataverseName().equals(dataverseName)) {
+                activeDataverse = MetadataBuiltinEntities.DEFAULT_DATAVERSE;
             }
             MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
             return true;
@@ -1383,8 +1392,8 @@
             }
 
             if (progress == ProgressState.ADDED_PENDINGOP_RECORD_TO_METADATA) {
-                if (activeDataverse != null && activeDataverse.getDataverseName() == dataverseName) {
-                    activeDataverse = null;
+                if (activeDataverse.getDataverseName().equals(dataverseName)) {
+                    activeDataverse = MetadataBuiltinEntities.DEFAULT_DATAVERSE;
                 }
 
                 // #. execute compensation operations
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/StringOffsetTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/StringOffsetTest.java
deleted file mode 100644
index 0400649..0000000
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/StringOffsetTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.test.runtime;
-
-import java.util.Collection;
-
-import org.apache.asterix.test.common.TestExecutor;
-import org.apache.asterix.testframework.context.TestCaseContext;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-/**
- * Overrides string offset to be 1 instead of 0
- */
-@RunWith(Parameterized.class)
-public class StringOffsetTest {
-    protected static final String TEST_CONFIG_FILE_NAME = "src/test/resources/cc-stringoffset.conf";
-
-    @BeforeClass
-    public static void setUp() throws Exception {
-        LangExecutionUtil.setUp(TEST_CONFIG_FILE_NAME, new TestExecutor());
-    }
-
-    @AfterClass
-    public static void tearDown() throws Exception {
-        LangExecutionUtil.tearDown();
-    }
-
-    @Parameterized.Parameters(name = "StringOffsetTest {index}: {0}")
-    public static Collection<Object[]> tests() throws Exception {
-        return LangExecutionUtil.tests("only_sqlpp.xml", "testsuite_stringoffset.xml");
-    }
-
-    protected TestCaseContext tcCtx;
-
-    public StringOffsetTest(TestCaseContext tcCtx) {
-        this.tcCtx = tcCtx;
-    }
-
-    @Test
-    public void test() throws Exception {
-        LangExecutionUtil.test(tcCtx);
-    }
-
-}
diff --git a/asterixdb/asterix-app/src/test/resources/cc-stringoffset.conf b/asterixdb/asterix-app/src/test/resources/cc-stringoffset.conf
deleted file mode 100644
index b176852..0000000
--- a/asterixdb/asterix-app/src/test/resources/cc-stringoffset.conf
+++ /dev/null
@@ -1,60 +0,0 @@
-; Licensed to the Apache Software Foundation (ASF) under one
-; or more contributor license agreements.  See the NOTICE file
-; distributed with this work for additional information
-; regarding copyright ownership.  The ASF licenses this file
-; to you under the Apache License, Version 2.0 (the
-; "License"); you may not use this file except in compliance
-; with the License.  You may obtain a copy of the License at
-;
-;   http://www.apache.org/licenses/LICENSE-2.0
-;
-; Unless required by applicable law or agreed to in writing,
-; software distributed under the License is distributed on an
-; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-; KIND, either express or implied.  See the License for the
-; specific language governing permissions and limitations
-; under the License.
-
-; Overrides string offset to be 1 instead of 0
-
-[nc/asterix_nc1]
-txn.log.dir=target/tmp/asterix_nc1/txnlog
-core.dump.dir=target/tmp/asterix_nc1/coredump
-iodevices=target/tmp/asterix_nc1/iodevice1,../asterix-server/target/tmp/asterix_nc1/iodevice2
-nc.api.port=19004
-#jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006
-
-[nc/asterix_nc2]
-ncservice.port=9091
-txn.log.dir=target/tmp/asterix_nc2/txnlog
-core.dump.dir=target/tmp/asterix_nc2/coredump
-iodevices=target/tmp/asterix_nc2/iodevice1,../asterix-server/target/tmp/asterix_nc2/iodevice2
-nc.api.port=19005
-#jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5007
-
-[nc]
-address=127.0.0.1
-command=asterixnc
-app.class=org.apache.asterix.hyracks.bootstrap.NCApplication
-jvm.args=-Xmx4096m -Dnode.Resolver="org.apache.asterix.external.util.IdentitiyResolverFactory"
-storage.buffercache.pagesize=32KB
-storage.buffercache.size=128MB
-storage.memorycomponent.globalbudget=512MB
-
-[cc]
-address = 127.0.0.1
-app.class=org.apache.asterix.hyracks.bootstrap.CCApplication
-heartbeat.period=2000
-heartbeat.max.misses=25
-
-[common]
-log.level = INFO
-compiler.framesize=32KB
-compiler.sortmemory=320KB
-compiler.groupmemory=160KB
-compiler.joinmemory=256KB
-compiler.windowmemory=192KB
-compiler.stringoffset=1
-messaging.frame.size=4096
-messaging.frame.count=512
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/upperCase/upperCase.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/upperCase/upperCase.3.query.sqlpp
index 743d39a..62c2b87 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/upperCase/upperCase.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/upperCase/upperCase.3.query.sqlpp
@@ -18,7 +18,7 @@
  */
 use externallibtest;
 
-let i={"id":1, "text_list": [{"text":"lower text1"}, {"text":"lower text2"}]}
+let i={"id":1, "text_list": [{"text":"lower text1"}, {"text":"lower text2"}], "another_list" : ["string_1", "string_2"]}
 select value `testlib#toUpper`(i);
 
 let i=`testlib#toUpper`({"id":1, "text_list":[{"text":"lower text"}]})
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos/pos.1.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos/pos.1.query.sqlpp
index 6568d06..ca2de43 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos/pos.1.query.sqlpp
@@ -17,4 +17,6 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// pos alias
+select element [pos(x, 'ofo'), pos(y,'ofo')]
+from  ['foofoo'] as x, ['barbar'] as y;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos0/pos0.1.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos0/pos0.1.query.sqlpp
index 6568d06..6bf0ff7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/pos0/pos0.1.query.sqlpp
@@ -17,4 +17,6 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// pos0 alias
+select element [pos0(x, 'ofo'), pos0(y,'ofo')]
+from  ['foofoo'] as x, ['barbar'] as y;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position/position.1.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position/position.1.query.sqlpp
index 7bd4fad..cdda7de 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position/position.1.query.sqlpp
@@ -17,6 +17,5 @@
  * under the License.
  */
 
-USE test;
-
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+select element [position(x, 'ofo'), position(y,'ofo')]
+from  ['foofoo'] as x, ['barbar'] as y;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/position.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position0/position0.1.query.sqlpp
similarity index 87%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/position.1.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position0/position0.1.query.sqlpp
index d8afe59..b46b177 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/position.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset0/position0/position0.1.query.sqlpp
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-select element [position(x,'ofo'), position(y,'ofo')]
-from  ['foofoo'] as x,
-      ['barbar'] as y
-;
+// position0 alias
+select element [position0(x, 'ofo'), position0(y,'ofo')]
+from  ['foofoo'] as x, ['barbar'] as y;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/pos1/pos1.1.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/pos1/pos1.1.query.sqlpp
index de3d809..24a2333 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/pos1/pos1.1.query.sqlpp
@@ -16,7 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-USE test;
-
-FROM ds SELECT VALUE regexp_like(test_str, pattern) ORDER BY id;
\ No newline at end of file
+// pos1 alias
+select value [
+    pos1('abcdefg','ab'),
+    pos1('abcdefg','de'),
+    pos1('abc', 'de')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/position/position.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/position1/position1.1.query.sqlpp
similarity index 86%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/position/position.1.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/position1/position1.1.query.sqlpp
index 8f321c4..acdffd1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/position/position.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/position/offset1/position1/position1.1.query.sqlpp
@@ -17,11 +17,9 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// position1 and pos1 alias
 select value [
-    position('abcdefg','ab'),
-    position('abcdefg','de'),
-    position('abc', 'de')
-]
-;
+    position1('abcdefg','ab'),
+    position1('abcdefg','de'),
+    position1('abc', 'de')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.3.query.sqlpp
new file mode 100644
index 0000000..59e468c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// contains_regex alias
+select element a
+from [
+      CONTAINS_REGEX('mnop','.'),
+      CONTAINS_REGEX('abcdefABCDEF','/d'),
+      CONTAINS_REGEX('12345','\\d'),
+      CONTAINS_REGEX('abcdefGHIJK','\\D'),
+      CONTAINS_REGEX('       ','\\s'),
+      CONTAINS_REGEX('       ','\\S'),
+      CONTAINS_REGEX('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      CONTAINS_REGEX('!@#$%^&*()','[a-zA-Z_0-9]'),
+      CONTAINS_REGEX('!@#$%^&*()','[^\\W]'),
+      CONTAINS_REGEX('!@#$%^&*','[^\\w]'),
+      CONTAINS_REGEX('0xffff','[\\p{XDigit}]'),
+      CONTAINS_REGEX('FFFFFFFF','[\\p{XDigit}]'),
+      CONTAINS_REGEX('abcdefgh','[\\p{javaLowerCase}]'),
+      CONTAINS_REGEX('ABCDEF','[\\p{javaLowerCase}]'),
+      CONTAINS_REGEX(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.4.query.sqlpp
index 7bd4fad..1c3738b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// contains_regex alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE contains_regex(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regex/contains_regex.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.3.query.sqlpp
new file mode 100644
index 0000000..31e2f39
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// contains_regexp alias
+select element a
+from [
+      CONTAINS_REGEXP('mnop','.'),
+      CONTAINS_REGEXP('abcdefABCDEF','/d'),
+      CONTAINS_REGEXP('12345','\\d'),
+      CONTAINS_REGEXP('abcdefGHIJK','\\D'),
+      CONTAINS_REGEXP('       ','\\s'),
+      CONTAINS_REGEXP('       ','\\S'),
+      CONTAINS_REGEXP('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      CONTAINS_REGEXP('!@#$%^&*()','[a-zA-Z_0-9]'),
+      CONTAINS_REGEXP('!@#$%^&*()','[^\\W]'),
+      CONTAINS_REGEXP('!@#$%^&*','[^\\w]'),
+      CONTAINS_REGEXP('0xffff','[\\p{XDigit}]'),
+      CONTAINS_REGEXP('FFFFFFFF','[\\p{XDigit}]'),
+      CONTAINS_REGEXP('abcdefgh','[\\p{javaLowerCase}]'),
+      CONTAINS_REGEXP('ABCDEF','[\\p{javaLowerCase}]'),
+      CONTAINS_REGEXP(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.4.query.sqlpp
index 7bd4fad..30570c0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// contains_regexp alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE contains_regexp(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/contains_regexp/contains_regexp.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.3.query.sqlpp
new file mode 100644
index 0000000..ae6931e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_contains alias
+select element a
+from [
+      REGEX_CONTAINS('mnop','.'),
+      REGEX_CONTAINS('abcdefABCDEF','/d'),
+      REGEX_CONTAINS('12345','\\d'),
+      REGEX_CONTAINS('abcdefGHIJK','\\D'),
+      REGEX_CONTAINS('       ','\\s'),
+      REGEX_CONTAINS('       ','\\S'),
+      REGEX_CONTAINS('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_CONTAINS('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_CONTAINS('!@#$%^&*()','[^\\W]'),
+      REGEX_CONTAINS('!@#$%^&*','[^\\w]'),
+      REGEX_CONTAINS('0xffff','[\\p{XDigit}]'),
+      REGEX_CONTAINS('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_CONTAINS('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_CONTAINS('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_CONTAINS(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.4.query.sqlpp
index 7bd4fad..f845d11 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_contains alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_contains(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regex_contains/regex_contains.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.3.query.sqlpp
similarity index 98%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.3.query.sqlpp
index a639365..da6968a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-
+// regex_contains function
 select element a
 from [
       REGEXP_CONTAINS('mnop','.'),
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.4.query.sqlpp
index 7090ce4..4e5f40c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_contains function
 USE test;
 
 FROM ds SELECT VALUE regexp_contains(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains/regexp_contains/regexp_contains.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.3.query.sqlpp
index 6568d06..3fdc250 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// contains_regex alias
+{'result1': CONTAINS_REGEX('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.4.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.4.query.sqlpp
index 7bd4fad..eedbf1b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// contains_regex alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE contains_regex(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.3.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.3.query.sqlpp
index 6568d06..e5083c5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// contains_regexp alias
+{'result1': CONTAINS_REGEXP('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.4.query.sqlpp
index 48c7aac..d3d149b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// contains_regexp alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE contains_regexp(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.3.query.sqlpp
index 6568d06..0e85b64 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regex_contains alias
+{'result1': REGEX_CONTAINS('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.4.query.sqlpp
index 199d20f..1c200c9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_contains alias
 USE test;
 
-FROM ds SELECT VALUE regexp_contains(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_contains(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp
index 0836054..339f744 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
+// regex_contains function
 {'result1': REGEXP_CONTAINS('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
index 199d20f..d0e2971 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_contains function
 USE test;
 
 FROM ds SELECT VALUE regexp_contains(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.3.query.sqlpp
new file mode 100644
index 0000000..ff6e9f2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.3.query.sqlpp
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_like alias
+select element a
+from [
+      REGEX_LIKE('mnop','.'),
+      REGEX_LIKE('abcdefABCDEF','/d'),
+      REGEX_LIKE('12345','\\d'),
+      REGEX_LIKE('abcdefGHIJK','\\D'),
+      REGEX_LIKE('       ','\\s'),
+      REGEX_LIKE('       ','\\S'),
+      REGEX_LIKE('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_LIKE('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_LIKE('!@#$%^&*()','[^\\W]'),
+      REGEX_LIKE('!@#$%^&*','[^\\w]'),
+      REGEX_LIKE('0xffff','[\\p{XDigit}]'),
+      REGEX_LIKE('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_LIKE('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_LIKE('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_LIKE(`codepoint-to-string`([163]),'[\\p{Sc}]'),
+      REGEX_LIKE('Steven','Ste(v|ph)en'),
+      REGEX_LIKE('Stephen','.*(v|ph)*')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.4.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.4.query.sqlpp
index 7bd4fad..9e2cd56 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_like alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_like(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regex_like/regex_like.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.3.query.sqlpp
similarity index 98%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.3.query.sqlpp
index eaaacc5..6316697 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-
+// regexp_like function
 select element a
 from [
       REGEXP_LIKE('mnop','.'),
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.4.query.sqlpp
similarity index 97%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.4.query.sqlpp
index de3d809..0c137bb 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_like function
 USE test;
 
 FROM ds SELECT VALUE regexp_like(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like/regexp_like.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.3.query.sqlpp
similarity index 91%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.3.query.sqlpp
index 91f90a4..256cb4c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_LIKE('helloworld','hello world','x')};
+// regex_like alias
+{'result1': REGEX_LIKE('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.4.query.sqlpp
index 7bd4fad..e0c91b6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_like alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_like(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp
deleted file mode 100644
index 199d20f..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-USE test;
-
-FROM ds SELECT VALUE regexp_contains(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
similarity index 97%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
index 91f90a4..0c34f4e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
+// regexp_like function
 {'result1': REGEXP_LIKE('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp
index 7bd4fad..ada33bf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_like function
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_like(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.3.query.sqlpp
new file mode 100644
index 0000000..0be9b7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_pos alias
+select element a
+from [
+      REGEX_POS('mnop','.'),
+      REGEX_POS('abcdefABCDEF','/d'),
+      REGEX_POS('12345','\\d'),
+      REGEX_POS('abcdefGHIJK','\\D'),
+      REGEX_POS('       ','\\s'),
+      REGEX_POS('       ','\\S'),
+      REGEX_POS('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_POS('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_POS('!@#$%^&*()','[^\\W]'),
+      REGEX_POS('!@#$%^&*','[^\\w]'),
+      REGEX_POS('0xffff','[\\p{XDigit}]'),
+      REGEX_POS('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_POS('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_POS('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_POS(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.4.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.4.query.sqlpp
index 7bd4fad..611f8ad 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_pos alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_pos(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos/regex_pos.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.3.query.sqlpp
new file mode 100644
index 0000000..99189aa
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_pos0 alias
+select element a
+from [
+      REGEX_POS0('mnop','.'),
+      REGEX_POS0('abcdefABCDEF','/d'),
+      REGEX_POS0('12345','\\d'),
+      REGEX_POS0('abcdefGHIJK','\\D'),
+      REGEX_POS0('       ','\\s'),
+      REGEX_POS0('       ','\\S'),
+      REGEX_POS0('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_POS0('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_POS0('!@#$%^&*()','[^\\W]'),
+      REGEX_POS0('!@#$%^&*','[^\\w]'),
+      REGEX_POS0('0xffff','[\\p{XDigit}]'),
+      REGEX_POS0('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_POS0('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_POS0('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_POS0(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.4.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.4.query.sqlpp
index 7bd4fad..3371f9e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_pos0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_pos0(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_pos0/regex_pos0.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.3.query.sqlpp
new file mode 100644
index 0000000..4385a13
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_position alias
+select element a
+from [
+      REGEX_POSITION('mnop','.'),
+      REGEX_POSITION('abcdefABCDEF','/d'),
+      REGEX_POSITION('12345','\\d'),
+      REGEX_POSITION('abcdefGHIJK','\\D'),
+      REGEX_POSITION('       ','\\s'),
+      REGEX_POSITION('       ','\\S'),
+      REGEX_POSITION('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_POSITION('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_POSITION('!@#$%^&*()','[^\\W]'),
+      REGEX_POSITION('!@#$%^&*','[^\\w]'),
+      REGEX_POSITION('0xffff','[\\p{XDigit}]'),
+      REGEX_POSITION('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_POSITION('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_POSITION('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_POSITION(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.4.query.sqlpp
index 7bd4fad..b394e98 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_position alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position/regex_position.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.3.query.sqlpp
new file mode 100644
index 0000000..888683a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_position0 alias
+select element a
+from [
+      REGEX_POSITION0('mnop','.'),
+      REGEX_POSITION0('abcdefABCDEF','/d'),
+      REGEX_POSITION0('12345','\\d'),
+      REGEX_POSITION0('abcdefGHIJK','\\D'),
+      REGEX_POSITION0('       ','\\s'),
+      REGEX_POSITION0('       ','\\S'),
+      REGEX_POSITION0('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEX_POSITION0('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEX_POSITION0('!@#$%^&*()','[^\\W]'),
+      REGEX_POSITION0('!@#$%^&*','[^\\w]'),
+      REGEX_POSITION0('0xffff','[\\p{XDigit}]'),
+      REGEX_POSITION0('FFFFFFFF','[\\p{XDigit}]'),
+      REGEX_POSITION0('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEX_POSITION0('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEX_POSITION0(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.4.query.sqlpp
index 7bd4fad..648a7ad1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_position0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_position0(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regex_position0/regex_position0.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.3.query.sqlpp
new file mode 100644
index 0000000..7780940
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regexp_pos alias
+select element a
+from [
+      REGEXP_POS('mnop','.'),
+      REGEXP_POS('abcdefABCDEF','/d'),
+      REGEXP_POS('12345','\\d'),
+      REGEXP_POS('abcdefGHIJK','\\D'),
+      REGEXP_POS('       ','\\s'),
+      REGEXP_POS('       ','\\S'),
+      REGEXP_POS('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEXP_POS('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEXP_POS('!@#$%^&*()','[^\\W]'),
+      REGEXP_POS('!@#$%^&*','[^\\w]'),
+      REGEXP_POS('0xffff','[\\p{XDigit}]'),
+      REGEXP_POS('FFFFFFFF','[\\p{XDigit}]'),
+      REGEXP_POS('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEXP_POS('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEXP_POS(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.4.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.4.query.sqlpp
index 7bd4fad..b1a0c23 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_pos alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_pos(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos/regexp_pos.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.3.query.sqlpp
new file mode 100644
index 0000000..cd8cde2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regexp_pos0 alias
+select element a
+from [
+      REGEXP_POS0('mnop','.'),
+      REGEXP_POS0('abcdefABCDEF','/d'),
+      REGEXP_POS0('12345','\\d'),
+      REGEXP_POS0('abcdefGHIJK','\\D'),
+      REGEXP_POS0('       ','\\s'),
+      REGEXP_POS0('       ','\\S'),
+      REGEXP_POS0('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEXP_POS0('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEXP_POS0('!@#$%^&*()','[^\\W]'),
+      REGEXP_POS0('!@#$%^&*','[^\\w]'),
+      REGEXP_POS0('0xffff','[\\p{XDigit}]'),
+      REGEXP_POS0('FFFFFFFF','[\\p{XDigit}]'),
+      REGEXP_POS0('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEXP_POS0('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEXP_POS0(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.4.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.4.query.sqlpp
index 7bd4fad..2e647fa 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_pos0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_pos0(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like/regexp_like.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_pos0/regexp_pos0.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.3.query.sqlpp
similarity index 94%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.3.query.sqlpp
index 41b4489..1faefe9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.3.query.sqlpp
@@ -17,7 +17,8 @@
  * under the License.
  */
 
-
+// regexp_position function
+// regex_pos, regex_position, regex_pos0, regex_position0
 select element a
 from [
       REGEXP_POSITION('mnop','.'),
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.4.query.sqlpp
index 7bd4fad..b4469db 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_position function
 USE test;
 
 FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position/regexp_position.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.3.query.sqlpp
new file mode 100644
index 0000000..996fba0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regexp_position0 alias
+select element a
+from [
+      REGEXP_POSITION0('mnop','.'),
+      REGEXP_POSITION0('abcdefABCDEF','/d'),
+      REGEXP_POSITION0('12345','\\d'),
+      REGEXP_POSITION0('abcdefGHIJK','\\D'),
+      REGEXP_POSITION0('       ','\\s'),
+      REGEXP_POSITION0('       ','\\S'),
+      REGEXP_POSITION0('Welcome to pattern matching!','[a-zA-Z_0-9]'),
+      REGEXP_POSITION0('!@#$%^&*()','[a-zA-Z_0-9]'),
+      REGEXP_POSITION0('!@#$%^&*()','[^\\W]'),
+      REGEXP_POSITION0('!@#$%^&*','[^\\w]'),
+      REGEXP_POSITION0('0xffff','[\\p{XDigit}]'),
+      REGEXP_POSITION0('FFFFFFFF','[\\p{XDigit}]'),
+      REGEXP_POSITION0('abcdefgh','[\\p{javaLowerCase}]'),
+      REGEXP_POSITION0('ABCDEF','[\\p{javaLowerCase}]'),
+      REGEXP_POSITION0(`codepoint-to-string`([163]),'[\\p{Sc}]')
+     ] as a
+;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.4.query.sqlpp
index 7bd4fad..16d64b5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_position0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_position0(test_str, pattern) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset0/regexp_position0/regexp_position0.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_pos1/regex_pos1.1.query.sqlpp
similarity index 84%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_pos1/regex_pos1.1.query.sqlpp
index ac47eb9..cbeff24 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_pos1/regex_pos1.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regex_pos1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+  REGEX_POS1('mnop','.'),
+  REGEX_POS1('mnop','p'),
+  REGEX_POS1('abcdefABCDEF','/d'),
+  REGEX_POS1('abcdefABCDEF','/d')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_position1/regex_position1.1.query.sqlpp
similarity index 82%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_position1/regex_position1.1.query.sqlpp
index ac47eb9..0156eb0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regex_position1/regex_position1.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regex_position1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+  REGEX_POSITION1('mnop','.'),
+  REGEX_POSITION1('mnop','p'),
+  REGEX_POSITION1('abcdefABCDEF','/d'),
+  REGEX_POSITION1('abcdefABCDEF','/d')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.query.sqlpp
similarity index 84%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.query.sqlpp
index ac47eb9..7142b7d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regexp_pos1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+  REGEXP_POS1('mnop','.'),
+  REGEXP_POS1('mnop','p'),
+  REGEXP_POS1('abcdefABCDEF','/d'),
+  REGEXP_POS1('abcdefABCDEF','/d')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_position1/regexp_position1.1.query.sqlpp
similarity index 81%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_position1/regexp_position1.1.query.sqlpp
index 65d10b5..78e6f5e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/offset1/regexp_position1/regexp_position1.1.query.sqlpp
@@ -17,13 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regexp_position1 function
 select value [
-    substring('abcdefg',-1),
-    substring('abcdefg',0),
-    substring('abcdefg',1),
-    substring('abcdefg',2),
-    substring('abcdefg',3)
-]
-;
+  REGEXP_POSITION1('mnop','.'),
+  REGEXP_POSITION1('mnop','p'),
+  REGEXP_POSITION1('abcdefABCDEF','/d'),
+  REGEXP_POSITION1('abcdefABCDEF','/d')
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.query.sqlpp
index 6568d06..7928e4c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regex_pos0 alias
+{'result1': REGEX_POS0('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.4.query.sqlpp
index 7bd4fad..b2a3bd6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_pos0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_pos0(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.query.sqlpp
similarity index 91%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.query.sqlpp
index 6568d06..0b87998 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regex_pos alias
+{'result1': REGEX_POS('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.4.query.sqlpp
index 7bd4fad..1fbc7dc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_pos alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_pos(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.query.sqlpp
index 6568d06..9b67976 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regex_position0 alias
+{'result1': REGEX_POSITION0('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.4.query.sqlpp
index 48c7aac..27315e9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_position0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_position0(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.query.sqlpp
index 6568d06..9514dbc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regex_position alias
+{'result1': REGEX_POSITION('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.4.query.sqlpp
index 48c7aac..b1c96ca 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_position alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_position(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.query.sqlpp
index 6568d06..7fb4d87 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regexp_pos0 alias
+{'result1': REGEXP_POS0('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.4.query.sqlpp
index 7bd4fad..9df6e69 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_pos0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_pos0(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.query.sqlpp
similarity index 90%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.query.sqlpp
index 6568d06..ee7d872 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regexp_pos alias
+{'result1': REGEXP_POS('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.4.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.4.query.sqlpp
index 7bd4fad..1900905 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_pos alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_pos(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_like_with_flag/regexp_like_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.query.sqlpp
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.query.sqlpp
index 6568d06..6277bbd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// regexp_position0 alias
+{'result1': REGEXP_POSITION0('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.4.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.4.query.sqlpp
index 7bd4fad..74018de 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_position0 alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regexp_position0(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flags.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
index 6568d06..46977b8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
+// regexp_position function
 {'result1': REGEXP_POSITION('helloworld','hello world','x')};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
index 48c7aac..6f7d337 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_position function
 USE test;
 
 FROM ds SELECT VALUE regexp_position(test_str, pattern, flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flags.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.query.sqlpp
similarity index 83%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.query.sqlpp
index ac47eb9..81458b9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regex_pos1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+  REGEX_POS1('mnop','.','x'),
+  REGEX_POS1('mnop','p','x'),
+  REGEX_POS1('abcdefABCDEF','/d','x'),
+  REGEX_POS1('abcdefABCDEF','/d','x')
+  ];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.query.sqlpp
similarity index 81%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.query.sqlpp
index 65d10b5..09876db 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.query.sqlpp
@@ -17,13 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regex_position1 alias
 select value [
-    substring('abcdefg',-1),
-    substring('abcdefg',0),
-    substring('abcdefg',1),
-    substring('abcdefg',2),
-    substring('abcdefg',3)
-]
-;
+  REGEX_POSITION1('mnop','.','x'),
+  REGEX_POSITION1('mnop','p','x'),
+  REGEX_POSITION1('abcdefABCDEF','/d','x'),
+  REGEX_POSITION1('abcdefABCDEF','/d','x')
+  ];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.query.sqlpp
similarity index 82%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.query.sqlpp
index ac47eb9..0c9ef50 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regexp_pos1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+  REGEXP_POS1('mnop','.','x'),
+  REGEXP_POS1('mnop','p','x'),
+  REGEXP_POS1('abcdefABCDEF','/d','x'),
+  REGEXP_POS1('abcdefABCDEF','/d','x')
+  ];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.query.sqlpp
index 65d10b5..d4030e8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.query.sqlpp
@@ -17,13 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// regexp_position1 function
 select value [
-    substring('abcdefg',-1),
-    substring('abcdefg',0),
-    substring('abcdefg',1),
-    substring('abcdefg',2),
-    substring('abcdefg',3)
-]
-;
+  REGEXP_POSITION1('mnop','.','x'),
+  REGEXP_POSITION1('mnop','p','x'),
+  REGEXP_POSITION1('abcdefABCDEF','/d','x'),
+  REGEXP_POSITION1('abcdefABCDEF','/d','x')
+  ];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.3.query.sqlpp
similarity index 77%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.3.query.sqlpp
index efd0084..6885841 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.3.query.sqlpp
@@ -17,11 +17,12 @@
  * under the License.
  */
 
+// regex_replace alias
 select element a
 from [
-  regexp_replace('abracadabra','a',''),
-  regexp_replace('abracadabra','a(.)','a$1$1'),
-  regexp_replace('darted','^(.*?)d(.*)$','$1c$2'),
-  regexp_replace('abracadabra','bra','*'),
-  regexp_replace('abracadabra','a.*a','*')
+  regex_replace('abracadabra','a',''),
+  regex_replace('abracadabra','a(.)','a$1$1'),
+  regex_replace('darted','^(.*?)d(.*)$','$1c$2'),
+  regex_replace('abracadabra','bra','*'),
+  regex_replace('abracadabra','a.*a','*')
 ] as a;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.4.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.4.query.sqlpp
index 7bd4fad..afdd088 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_replace alias
 USE test;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_replace(test_str, pattern, "REPLACED") ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regex_replace/regex_replace.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.3.query.sqlpp
similarity index 97%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.3.query.sqlpp
index efd0084..6962526 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.3.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_replace function
 select element a
 from [
   regexp_replace('abracadabra','a',''),
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.4.query.sqlpp
index cbb55de..3a99397 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_replace function
 USE test;
 
 FROM ds SELECT VALUE regexp_replace(test_str, pattern, "REPLACED") ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace/regexp_replace/regexp_replace.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.3.query.sqlpp
new file mode 100644
index 0000000..a051458
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// regex_replace alias
+select element a
+from [
+  regex_replace('abracadabra','',null,null),
+  regex_replace('abracadabra','bra','XXX',''),
+  regex_replace(null,'hello world','XxXx','x'),
+  regex_replace('abracadabra','bra','XXX',null),
+  regex_replace('abracadabra',null,'XXX',null),
+  regex_replace('abracadabra','Bra',null,'i'),
+  regex_replace('abracadabra','Bra','','i'),
+  regex_replace('abracadabra','','XXX',''),
+  regex_replace('abracadabra','Bra','kkk',''),
+  regex_replace('abracadabra','Bra','kkk','i'),
+  regex_replace('helloworld','hello world','kkk','x'),
+  regex_replace('abracadabra','bra','kkk',-1),
+  regex_replace('abracadabra','bra','kkk',0),
+  regex_replace('abracadabra','bra','kkk',1),
+  regex_replace('abracadabra_abracadabra','bra','kkk',2),
+  regex_replace('abracadabra_abracadabra','bra','kkk',5)
+] as a;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.4.query.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.4.query.sqlpp
index 42eaae7..0355129 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regex_replace alias
 USE test;
 
-FROM ds SELECT VALUE regexp_replace(test_str, pattern, "REPLACED", flags) ORDER BY id;
\ No newline at end of file
+FROM ds SELECT VALUE regex_replace(test_str, pattern, "REPLACED", flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.5.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp
similarity index 98%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp
index 90504e5..454debc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.3.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_replace function
 select element a
 from [
   regexp_replace('abracadabra','',null,null),
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
index 42eaae7..de876a5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.4.query.sqlpp
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+// regexp_replace function
 USE test;
 
 FROM ds SELECT VALUE regexp_replace(test_str, pattern, "REPLACED", flags) ORDER BY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.5.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.3.query.sqlpp
similarity index 67%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.3.query.sqlpp
index 6568d06..ad52387 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr/substr.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// substr alias
+{'str2':substr('Hello World',9),'str4':substr('This is a test string',20),'str6':substr('This is a test string',21),'str8':substr('This is a test string',0),'str10':substr('This is a test string',-6),'str13':substr(`string-concat`(['This is a test string','This is a another test string']),20),'str14':substr('UC Irvine',(`string-length`('UC Irvine') div 2 - 1))};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.3.query.sqlpp
similarity index 67%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.3.query.sqlpp
index 6568d06..59e99c9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substr0/substr0.3.query.sqlpp
@@ -17,4 +17,5 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+// substr0 alias
+{'str2':substr0('Hello World',9),'str4':substr0('This is a test string',20),'str6':substr0('This is a test string',21),'str8':substr0('This is a test string',0),'str10':substr0('This is a test string',-6),'str13':substr0(`string-concat`(['This is a test string','This is a another test string']),20),'str14':substr0('UC Irvine',(`string-length`('UC Irvine') div 2 - 1))};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.3.query.sqlpp
similarity index 86%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.3.query.sqlpp
index d39e51e..7e99d46 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring/substring.3.query.sqlpp
@@ -16,11 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/*
- * Testcase Name  : substr01.aql
- * Description    : Test substring2(string,position) built in function.
- * Success        : Yes
- * Date           : 18th April 2012
- */
 
-{'str2':substring('Hello World',9),'str4':substring('This is a test string',20),'str6':substring('This is a test string',21),'str8':substring('This is a test string',0),'str10':substring('This is a test string',-6),'str13':substring(`string-concat`(['This is a test string','This is a another test string']),20),'str14':substring('UC Irvine',(`string-length`('UC Irvine') div 2 - 1))};
+// substring
+{'str2':substring('Hello World',9),'str4':substring('This is a test string',20),'str6':substring('This is a test string',21),'str8':substring('This is a test string',0),'str10':substring('This is a test string',-6),'str13':substring(`string-concat`(['This is a test string','This is a another test string']),20),'str14':substring('UC Irvine',(`string-length`('UC Irvine') div 2 - 1))};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.3.query.sqlpp
similarity index 66%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.3.query.sqlpp
index 65d10b5..1bae41a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring2/substring2.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset0/substring0/substring0.3.query.sqlpp
@@ -17,13 +17,5 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
-select value [
-    substring('abcdefg',-1),
-    substring('abcdefg',0),
-    substring('abcdefg',1),
-    substring('abcdefg',2),
-    substring('abcdefg',3)
-]
-;
+// substring0 alias
+{'str2':substring0('Hello World',9),'str4':substring0('This is a test string',20),'str6':substring0('This is a test string',21),'str8':substring0('This is a test string',0),'str10':substring0('This is a test string',-6),'str13':substring0(`string-concat`(['This is a test string','This is a another test string']),20),'str14':substring0('UC Irvine',(`string-length`('UC Irvine') div 2 - 1))};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substr1/substr1.1.query.sqlpp
similarity index 83%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substr1/substr1.1.query.sqlpp
index ac47eb9..71bcada 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substr1/substr1.1.query.sqlpp
@@ -17,10 +17,11 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// substr1 alias
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+    substr1('abcdefg',-1,2),
+    substr1('abcdefg',0,2),
+    substr1('abcdefg',1,2),
+    substr1('abcdefg',2,2),
+    substr1('abcdefg',3,2)
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substring1/substring1.1.query.sqlpp
similarity index 82%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substring1/substring1.1.query.sqlpp
index ac47eb9..4a9854f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/offset1/substring1/substring1.1.query.sqlpp
@@ -17,10 +17,11 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
+// substring1
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+    substring1('abcdefg',-1,2),
+    substring1('abcdefg',0,2),
+    substring1('abcdefg',1,2),
+    substring1('abcdefg',2,2),
+    substring1('abcdefg',3,2)
+];
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.1.ddl.sqlpp
deleted file mode 100644
index 76880bd..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.1.ddl.sqlpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Testcase Name  : substr01.aql
- * Description    : Test substring2(string,position) built in function.
- * Success        : Yes
- * Date           : 18th April 2012
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.2.update.sqlpp
deleted file mode 100644
index 76880bd..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substr01/substr01.2.update.sqlpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Testcase Name  : substr01.aql
- * Description    : Test substring2(string,position) built in function.
- * Success        : Yes
- * Date           : 18th April 2012
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.1.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.2.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.3.query.sqlpp
similarity index 94%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.3.query.sqlpp
index fa3b8af..0ffd90b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.3.query.sqlpp
@@ -19,5 +19,4 @@
 
 use test;
 
-
-{'result1':test.substring('HEllow',1)};
+{'result1':test.substr('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.4.ddl.sqlpp
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.4.ddl.sqlpp
index fa3b8af..ddbdccf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr/substr.4.ddl.sqlpp
@@ -17,7 +17,5 @@
  * under the License.
  */
 
-use test;
+drop  dataverse test;
 
-
-{'result1':test.substring('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.3.query.sqlpp
similarity index 94%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.3.query.sqlpp
index fa3b8af..d79c789 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.3.query.sqlpp
@@ -19,5 +19,4 @@
 
 use test;
 
-
-{'result1':test.substring('HEllow',1)};
+{'result1':test.substr0('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.4.ddl.sqlpp
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.4.ddl.sqlpp
index fa3b8af..ddbdccf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substr0/substr0.4.ddl.sqlpp
@@ -17,7 +17,5 @@
  * under the License.
  */
 
-use test;
+drop  dataverse test;
 
-
-{'result1':test.substring('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.3.query.sqlpp
similarity index 99%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.3.query.sqlpp
index fa3b8af..a311558 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.3.query.sqlpp
@@ -19,5 +19,4 @@
 
 use test;
 
-
 {'result1':test.substring('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.4.ddl.sqlpp
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.4.ddl.sqlpp
index fa3b8af..ddbdccf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring/substring.4.ddl.sqlpp
@@ -17,7 +17,5 @@
  * under the License.
  */
 
-use test;
+drop  dataverse test;
 
-
-{'result1':test.substring('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.1.ddl.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.1.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.2.update.sqlpp
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.2.update.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.2.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.3.query.sqlpp
similarity index 94%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.3.query.sqlpp
index fa3b8af..289302d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.3.query.sqlpp
@@ -19,5 +19,4 @@
 
 use test;
 
-
-{'result1':test.substring('HEllow',1)};
+{'result1':test.substring0('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.4.ddl.sqlpp
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.4.ddl.sqlpp
index fa3b8af..ddbdccf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/substring2-1.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset0/substring0/substring0.4.ddl.sqlpp
@@ -17,7 +17,5 @@
  * under the License.
  */
 
-use test;
+drop  dataverse test;
 
-
-{'result1':test.substring('HEllow',1)};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position/regexp_position.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substr1/substr1.1.query.sqlpp
similarity index 85%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position/regexp_position.1.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substr1/substr1.1.query.sqlpp
index 7a27b2f..6f3ea00 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position/regexp_position.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substr1/substr1.1.query.sqlpp
@@ -17,12 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
 select value [
-  REGEXP_POSITION('mnop','.'),
-  REGEXP_POSITION('mnop','p'),
-  REGEXP_POSITION('abcdefABCDEF','/d')
-]
-
-
+    substr1('abcdefg',-1),
+    substr1('abcdefg',0),
+    substr1('abcdefg',1),
+    substr1('abcdefg',2),
+    substr1('abcdefg',3)
+];
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substring1/substring1.1.query.sqlpp
similarity index 84%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substring1/substring1.1.query.sqlpp
index ac47eb9..5726c08 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/substring2-1/offset1/substring1/substring1.1.query.sqlpp
@@ -17,10 +17,10 @@
  * under the License.
  */
 
-/* String offset is set to 1 */
-
 select value [
-  REGEXP_POSITION('mnop','.','x'),
-  REGEXP_POSITION('mnop','p','x'),
-  REGEXP_POSITION('abcdefABCDEF','/d','x')
-]
+    substring1('abcdefg',-1),
+    substring1('abcdefg',0),
+    substring1('abcdefg',1),
+    substring1('abcdefg',2),
+    substring1('abcdefg',3)
+];
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary/findbinary.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary/findbinary.1.query.sqlpp
deleted file mode 100644
index 073220f..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary/findbinary.1.query.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* String offset is set to 1 */
-
-select value [
-    find_binary(hex('aabbccddeeffaabbccddeeff'),hex('aabb'),-1),
-    find_binary(hex('aabbccddeeffaabbccddeeff'),hex('aabb'),0),
-    find_binary(hex('aabbccddeeffaabbccddeeff'),hex('aabb'),1),
-    find_binary(hex('aabbccddeeffaabbccddeeff'),hex('aabb'),2),
-    find_binary(hex('aabbccddeeffaabbccddeeff'),hex('1122'))
-]
-;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary2/findbinary2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary2/findbinary2.1.query.sqlpp
deleted file mode 100644
index 7ea703e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/findbinary2/findbinary2.1.query.sqlpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* String offset is set to 1 */
-
-select value [
-    find_binary(hex('aabbccddeeff'),hex('aabb')),
-    find_binary(hex('aabbccddeeff'),hex('ccdd')),
-    find_binary(hex('aabbccddeeff'),hex('1122'))
-]
-;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary/subbinary.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary/subbinary.1.query.sqlpp
deleted file mode 100644
index 6989cf7..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary/subbinary.1.query.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* String offset is set to 1 */
-
-select value [
-    print_binary(sub_binary(hex('aabbccddeeff'),-1,2), "hex"),
-    print_binary(sub_binary(hex('aabbccddeeff'),0,2), "hex"),
-    print_binary(sub_binary(hex('aabbccddeeff'),1,2), "hex"),
-    print_binary(sub_binary(hex('aabbccddeeff'),2,2), "hex"),
-    print_binary(sub_binary(hex('aabbccddeeff'),3,2), "hex")
-]
-;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary2/subbinary2.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary2/subbinary2.1.query.sqlpp
deleted file mode 100644
index 075f803..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/subbinary2/subbinary2.1.query.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* String offset is set to 1 */
-
-select value [
-    print_binary(sub_binary(hex('aabbccddeeff'),-1), 'hex'),
-    print_binary(sub_binary(hex('aabbccddeeff'),0), 'hex'),
-    print_binary(sub_binary(hex('aabbccddeeff'),1), 'hex'),
-    print_binary(sub_binary(hex('aabbccddeeff'),2), 'hex'),
-    print_binary(sub_binary(hex('aabbccddeeff'),3), 'hex')
-]
-;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring/substring.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring/substring.1.query.sqlpp
deleted file mode 100644
index 1c35e7f..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/stringoffset/substring/substring.1.query.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/* String offset is set to 1 */
-
-select value [
-    substring('abcdefg',-1,2),
-    substring('abcdefg',0,2),
-    substring('abcdefg',1,2),
-    substring('abcdefg',2,2),
-    substring('abcdefg',3,2)
-]
-;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos/pos.1.adm
similarity index 89%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos/pos.1.adm
index 76e3e97..6a32c90 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos/pos.1.adm
@@ -1 +1 @@
-[ 2, -1 ]
+[ 2, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos0/pos0.1.adm
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos0/pos0.1.adm
index 76e3e97..6a32c90 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/pos0/pos0.1.adm
@@ -1 +1 @@
-[ 2, -1 ]
+[ 2, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position/position.1.adm
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position/position.1.adm
index 76e3e97..6a32c90 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position/position.1.adm
@@ -1 +1 @@
-[ 2, -1 ]
+[ 2, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position0/position0.1.adm
similarity index 89%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position0/position0.1.adm
index 76e3e97..6a32c90 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/position.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset0/position0/position0.1.adm
@@ -1 +1 @@
-[ 2, -1 ]
+[ 2, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset1/pos1/pos1.1.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/position/position.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset1/pos1/pos1.1.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/position/position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset1/position1/position1.1.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/position/position.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/position/offset1/position1/position1.1.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regex/contains_regex.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regex/contains_regex.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regex/contains_regex.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regex/contains_regex.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regexp/contains_regexp.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regexp/contains_regexp.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regexp/contains_regexp.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/contains_regexp/contains_regexp.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regex_contains/regex_contains.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regex_contains/regex_contains.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regex_contains/regex_contains.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regex_contains/regex_contains.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains/regexp_contains.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains/regexp_contains.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains/regexp_contains.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains/regexp_contains/regexp_contains.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regex_with_flag/contains_regex_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/contains_regexp_with_flag/contains_regexp_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regex_contains_with_flag/regex_contains_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_contains_with_flag/regexp_contains_with_flag/regexp_contains_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regex_like/regex_like.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regex_like/regex_like.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regex_like/regex_like.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regex_like/regex_like.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like/regexp_like.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like/regexp_like.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like/regexp_like.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like/regexp_like/regexp_like.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regex_like_with_flag/regex_like_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_like_with_flag/regexp_like_with_flag/regexp_like_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos/regex_pos.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos/regex_pos.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos/regex_pos.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos/regex_pos.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos0/regex_pos0.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos0/regex_pos0.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos0/regex_pos0.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_pos0/regex_pos0.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position/regex_position.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position/regex_position.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position/regex_position.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position/regex_position.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position0/regex_position0.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position0/regex_position0.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position0/regex_position0.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regex_position0/regex_position0.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos/regexp_pos.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos/regexp_pos.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos/regexp_pos.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos/regexp_pos.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos0/regexp_pos0.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos0/regexp_pos0.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos0/regexp_pos0.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_pos0/regexp_pos0.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position/regexp_position.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position/regexp_position.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position/regexp_position.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position/regexp_position.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position0/regexp_position0.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position0/regexp_position0.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position0/regexp_position0.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/regexp_position.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset0/regexp_position0/regexp_position0.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_pos1/regex_pos1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_pos1/regex_pos1.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_pos1/regex_pos1.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_position1/regex_position1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_position1/regex_position1.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regex_position1/regex_position1.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_pos1/regexp_pos1.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_position1/regexp_position1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_position1/regexp_position1.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position/offset1/regexp_position1/regexp_position1.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.adm
similarity index 93%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos0_with_flag/regex_pos0_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_pos_with_flag/regex_pos_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position0_with_flag/regex_position0_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regex_position_with_flag/regex_position_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos0_with_flag/regexp_pos0_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_pos_with_flag/regexp_pos_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position0_with_flag/regexp_position0_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.adm
similarity index 93%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.adm
index fa99af7..66ca9ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.3.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.3.adm
@@ -1 +1 @@
-{ "result1": 0 }
+{ "result1": 0 }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/regexp_position_with_flag.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset0/regexp_position_with_flag/regexp_position_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_pos1_with_flag/regex_pos1_with_flag.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regex_position1_with_flag/regex_position1_with_flag.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_pos1_with_flag/regexp_pos1_with_flag.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.adm
new file mode 100644
index 0000000..bed66c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_position_with_flag/offset1/regexp_position1_with_flag/regexp_position1_with_flag.1.adm
@@ -0,0 +1 @@
+[ 1, 4, -1, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regex_replace/regex_replace.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regex_replace/regex_replace.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regex_replace/regex_replace.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regex_replace/regex_replace.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace/regexp_replace.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace/regexp_replace.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace/regexp_replace.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace/regexp_replace/regexp_replace.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.3.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.3.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.4.adm
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.4.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regex_replace_with_flag/regex_replace_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.3.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.4.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag.4.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/regexp_replace_with_flag/regexp_replace_with_flag/regexp_replace_with_flag.4.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr/substr.1.adm
similarity index 98%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr/substr.1.adm
index c8cbcf0..f08055a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr/substr.1.adm
@@ -1 +1 @@
-{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
+{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr0/substr0.1.adm
similarity index 98%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr0/substr0.1.adm
index c8cbcf0..f08055a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substr0/substr0.1.adm
@@ -1 +1 @@
-{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
+{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring/substring.1.adm
similarity index 98%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring/substring.1.adm
index c8cbcf0..f08055a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring/substring.1.adm
@@ -1 +1 @@
-{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
+{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring0/substring0.1.adm
similarity index 98%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring0/substring0.1.adm
index c8cbcf0..f08055a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/substr01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset0/substring0/substring0.1.adm
@@ -1 +1 @@
-{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
+{ "str2": "ld", "str4": "g", "str6": null, "str8": "This is a test string", "str10": "string", "str13": "gThis is a another test string", "str14": "Irvine" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substr1/substr1.1.adm
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substr1/substr1.1.adm
index a94cd89..ba46923 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substr1/substr1.1.adm
@@ -1 +1 @@
-[ "g", null, "ab", "bc", "cd" ]
+[ "g", null, "ab", "bc", "cd" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substring1/substring1.1.adm
similarity index 96%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substring1/substring1.1.adm
index a94cd89..ba46923 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring/substring.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substr01/offset1/substring1/substring1.1.adm
@@ -1 +1 @@
-[ "g", null, "ab", "bc", "cd" ]
+[ "g", null, "ab", "bc", "cd" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr/substr.1.adm
similarity index 95%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr/substr.1.adm
index 411e803..01dd3e4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr/substr.1.adm
@@ -1 +1 @@
-{ "result1": "Ellow" }
+{ "result1": "Ellow" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr0/substr0.1.adm
similarity index 95%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr0/substr0.1.adm
index 411e803..01dd3e4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substr0/substr0.1.adm
@@ -1 +1 @@
-{ "result1": "Ellow" }
+{ "result1": "Ellow" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring/substring.1.adm
similarity index 95%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring/substring.1.adm
index 411e803..01dd3e4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring/substring.1.adm
@@ -1 +1 @@
-{ "result1": "Ellow" }
+{ "result1": "Ellow" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring0/substring0.1.adm
similarity index 95%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring0/substring0.1.adm
index 411e803..01dd3e4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/substring2-1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset0/substring0/substring0.1.adm
@@ -1 +1 @@
-{ "result1": "Ellow" }
+{ "result1": "Ellow" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substr1/substr1.1.adm
similarity index 97%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substr1/substr1.1.adm
index 9b005ca..772cf57 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substr1/substr1.1.adm
@@ -1 +1 @@
-[ "g", null, "abcdefg", "bcdefg", "cdefg" ]
+[ "g", null, "abcdefg", "bcdefg", "cdefg" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substring1/substring1.1.adm
similarity index 97%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm
copy to asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substring1/substring1.1.adm
index 9b005ca..772cf57 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/substring2/substring2.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/string/substring2-1/offset1/substring1/substring1.1.adm
@@ -1 +1 @@
-[ "g", null, "abcdefg", "bcdefg", "cdefg" ]
+[ "g", null, "abcdefg", "bcdefg", "cdefg" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary/findbinary.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary/findbinary.1.adm
deleted file mode 100644
index 0fae953..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary/findbinary.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ 1, 1, 1, 7, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary2/findbinary2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary2/findbinary2.1.adm
deleted file mode 100644
index 299ae43..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/findbinary2/findbinary2.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ 1, 3, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position/regexp_position.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position/regexp_position.1.adm
deleted file mode 100644
index 613f89b..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position/regexp_position.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ 1, 4, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.adm
deleted file mode 100644
index 613f89b..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/regexp_position_with_flag/regexp_position_with_flag.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ 1, 4, -1 ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary/subbinary.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary/subbinary.1.adm
deleted file mode 100644
index f5e809d..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary/subbinary.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ "AABB", "AABB", "AABB", "BBCC", "CCDD" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary2/subbinary2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary2/subbinary2.1.adm
deleted file mode 100644
index 275d27a..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/stringoffset/subbinary2/subbinary2.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-[ "AABBCCDDEEFF", "AABBCCDDEEFF", "AABBCCDDEEFF", "BBCCDDEEFF", "CCDDEEFF" ]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.1.ast
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.1.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.2.ast
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.2.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.2.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.3.ast
similarity index 99%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.3.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.3.ast
index 9d1c274..31a6a19 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.3.ast
@@ -71,4 +71,4 @@
       ]
     ]
   )
-]
+]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.4.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/offset0/substring/substring.4.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.1.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.1.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.2.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.2.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.2.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.3.ast
similarity index 98%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.3.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.3.ast
index c170655..f0f9f15 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.3.ast
@@ -9,4 +9,4 @@
       LiteralExpr [LONG] [1]
     ]
   )
-]
+]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.4.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substr01/substr01.1.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/offset0/substring/substring.4.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.1.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.1.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.2.ast
deleted file mode 100644
index e69de29..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/string/substring2-1/substring2-1.2.ast
+++ /dev/null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 24988bb..ba0a084 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -8770,38 +8770,213 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="position">
-        <output-dir compare="Text">position</output-dir>
+      <compilation-unit name="position/offset0/position">
+        <output-dir compare="Text">position/offset0/position</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_contains">
-        <output-dir compare="Text">regexp_contains</output-dir>
+      <compilation-unit name="position/offset0/pos">
+        <output-dir compare="Text">position/offset0/pos</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_contains_with_flag">
-        <output-dir compare="Text">regexp_contains_with_flag</output-dir>
+      <compilation-unit name="position/offset0/position0">
+        <output-dir compare="Text">position/offset0/position0</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_like">
-        <output-dir compare="Text">regexp_like</output-dir>
+      <compilation-unit name="position/offset0/pos0">
+        <output-dir compare="Text">position/offset0/pos0</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_like_with_flag">
-        <output-dir compare="Text">regexp_like_with_flag</output-dir>
+      <compilation-unit name="position/offset1/position1">
+        <output-dir compare="Text">position/offset1/position1</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_position">
-        <output-dir compare="Text">regexp_position</output-dir>
+      <compilation-unit name="position/offset1/pos1">
+        <output-dir compare="Text">position/offset1/pos1</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_position_with_flag">
-        <output-dir compare="Text">regexp_position_with_flag</output-dir>
+      <compilation-unit name="regexp_contains/regexp_contains">
+        <output-dir compare="Text">regexp_contains/regexp_contains</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains/regex_contains">
+        <output-dir compare="Text">regexp_contains/regex_contains</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains/contains_regexp">
+        <output-dir compare="Text">regexp_contains/contains_regexp</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains/contains_regex">
+        <output-dir compare="Text">regexp_contains/contains_regex</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains_with_flag/regexp_contains_with_flag">
+        <output-dir compare="Text">regexp_contains_with_flag/regexp_contains_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains_with_flag/regex_contains_with_flag">
+        <output-dir compare="Text">regexp_contains_with_flag/regex_contains_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains_with_flag/contains_regexp_with_flag">
+        <output-dir compare="Text">regexp_contains_with_flag/contains_regexp_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_contains_with_flag/contains_regex_with_flag">
+        <output-dir compare="Text">regexp_contains_with_flag/contains_regex_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_like/regexp_like">
+        <output-dir compare="Text">regexp_like/regexp_like</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_like/regex_like">
+        <output-dir compare="Text">regexp_like/regex_like</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_like_with_flag/regexp_like_with_flag">
+        <output-dir compare="Text">regexp_like_with_flag/regexp_like_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_like_with_flag/regex_like_with_flag">
+        <output-dir compare="Text">regexp_like_with_flag/regex_like_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regexp_position">
+        <output-dir compare="Text">regexp_position/offset0/regexp_position</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regexp_pos">
+        <output-dir compare="Text">regexp_position/offset0/regexp_pos</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regexp_position0">
+        <output-dir compare="Text">regexp_position/offset0/regexp_position0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regexp_pos0">
+        <output-dir compare="Text">regexp_position/offset0/regexp_pos0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regex_position">
+        <output-dir compare="Text">regexp_position/offset0/regex_position</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regex_pos">
+        <output-dir compare="Text">regexp_position/offset0/regex_pos</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regex_position0">
+        <output-dir compare="Text">regexp_position/offset0/regex_position0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset0/regex_pos0">
+        <output-dir compare="Text">regexp_position/offset0/regex_pos0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset1/regexp_position1">
+        <output-dir compare="Text">regexp_position/offset1/regexp_position1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset1/regexp_pos1">
+        <output-dir compare="Text">regexp_position/offset1/regexp_pos1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset1/regex_position1">
+        <output-dir compare="Text">regexp_position/offset1/regex_position1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position/offset1/regex_pos1">
+        <output-dir compare="Text">regexp_position/offset1/regex_pos1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regexp_position_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regexp_position_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regexp_pos_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regexp_pos_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regexp_position0_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regexp_position0_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regexp_pos0_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regexp_pos0_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regex_position_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regex_position_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regex_pos_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regex_pos_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regex_position0_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regex_position0_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset0/regex_pos0_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset0/regex_pos0_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset1/regexp_position1_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset1/regexp_position1_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset1/regexp_pos1_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset1/regexp_pos1_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset1/regex_position1_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset1/regex_position1_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_position_with_flag/offset1/regex_pos1_with_flag">
+        <output-dir compare="Text">regexp_position_with_flag/offset1/regex_pos1_with_flag</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
@@ -8820,13 +8995,23 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_replace">
-        <output-dir compare="Text">regexp_replace</output-dir>
+      <compilation-unit name="regexp_replace/regexp_replace">
+        <output-dir compare="Text">regexp_replace/regexp_replace</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="regexp_replace_with_flag">
-        <output-dir compare="Text">regexp_replace_with_flag</output-dir>
+      <compilation-unit name="regexp_replace/regex_replace">
+        <output-dir compare="Text">regexp_replace/regex_replace</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_replace_with_flag/regexp_replace_with_flag">
+        <output-dir compare="Text">regexp_replace_with_flag/regexp_replace_with_flag</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="regexp_replace_with_flag/regex_replace_with_flag">
+        <output-dir compare="Text">regexp_replace_with_flag/regex_replace_with_flag</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
@@ -8955,8 +9140,33 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="substr01">
-        <output-dir compare="Text">substr01</output-dir>
+      <compilation-unit name="substr01/offset0/substring">
+        <output-dir compare="Text">substr01/offset0/substring</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substr01/offset0/substr">
+        <output-dir compare="Text">substr01/offset0/substr</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substr01/offset0/substring0">
+        <output-dir compare="Text">substr01/offset0/substring0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substr01/offset0/substr0">
+        <output-dir compare="Text">substr01/offset0/substr0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substr01/offset1/substring1">
+        <output-dir compare="Text">substr01/offset1/substring1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substr01/offset1/substr1">
+        <output-dir compare="Text">substr01/offset1/substr1</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
@@ -9010,8 +9220,33 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="substring2-1">
-        <output-dir compare="Text">substring2-1</output-dir>
+      <compilation-unit name="substring2-1/offset0/substring">
+        <output-dir compare="Text">substring2-1/offset0/substring</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substring2-1/offset0/substr">
+        <output-dir compare="Text">substring2-1/offset0/substr</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substring2-1/offset0/substring0">
+        <output-dir compare="Text">substring2-1/offset0/substring0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substring2-1/offset0/substr0">
+        <output-dir compare="Text">substring2-1/offset0/substr0</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substring2-1/offset1/substring1">
+        <output-dir compare="Text">substring2-1/offset1/substring1</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="string">
+      <compilation-unit name="substring2-1/offset1/substr1">
+        <output-dir compare="Text">substring2-1/offset1/substr1</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
index 55f4962..ffde5ff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
@@ -5063,8 +5063,8 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="substr01">
-        <output-dir compare="AST">substr01</output-dir>
+      <compilation-unit name="substr01/offset0/substring">
+        <output-dir compare="AST">substr01/offset0/substring</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
@@ -5118,8 +5118,8 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
-      <compilation-unit name="substring2-1">
-        <output-dir compare="AST">substring2-1</output-dir>
+      <compilation-unit name="substring2-1/offset0/substring">
+        <output-dir compare="AST">substring2-1/offset0/substring</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="string">
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_stringoffset.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_stringoffset.xml
deleted file mode 100644
index f7da162..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_stringoffset.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements.  See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership.  The ASF licenses this file
- ! to you under the Apache License, Version 2.0 (the
- ! "License"); you may not use this file except in compliance
- ! with the License.  You may obtain a copy of the License at
- !
- !   http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing,
- ! software distributed under the License is distributed on an
- ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ! KIND, either express or implied.  See the License for the
- ! specific language governing permissions and limitations
- ! under the License.
- !-->
-<test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results" QueryOffsetPath="queries_sqlpp" QueryFileExtension=".sqlpp">
-  <test-group name="stringoffset">
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="position">
-        <output-dir compare="Text">position</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="regexp_position">
-        <output-dir compare="Text">regexp_position</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="regexp_position_with_flag">
-        <output-dir compare="Text">regexp_position_with_flag</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="substring">
-        <output-dir compare="Text">substring</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="substring2">
-        <output-dir compare="Text">substring2</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="subbinary">
-        <output-dir compare="Text">subbinary</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="subbinary2">
-        <output-dir compare="Text">subbinary2</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="findbinary">
-        <output-dir compare="Text">findbinary</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="stringoffset">
-      <compilation-unit name="findbinary2">
-        <output-dir compare="Text">findbinary2</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
-</test-suite>
\ No newline at end of file
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
index 9428e6f..bdeaddb 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java
@@ -23,7 +23,6 @@
 import static org.apache.hyracks.control.common.config.OptionTypes.INTEGER_BYTE_UNIT;
 import static org.apache.hyracks.control.common.config.OptionTypes.LONG_BYTE_UNIT;
 import static org.apache.hyracks.control.common.config.OptionTypes.POSITIVE_INTEGER;
-import static org.apache.hyracks.control.common.config.OptionTypes.UNSIGNED_INTEGER;
 import static org.apache.hyracks.util.StorageUtil.StorageUnit.KILOBYTE;
 import static org.apache.hyracks.util.StorageUtil.StorageUnit.MEGABYTE;
 
@@ -68,7 +67,6 @@
                         + "other integer values dictate the number of query execution parallel partitions. The system will "
                         + "fall back to use the number of all available CPU cores in the cluster as the degree of parallelism "
                         + "if the number set by a user is too large or too small"),
-        COMPILER_STRINGOFFSET(UNSIGNED_INTEGER, 0, "Position of a first character in a String/Binary (0 or 1)"),
         COMPILER_SORT_PARALLEL(BOOLEAN, AlgebricksConfig.SORT_PARALLEL, "Enabling/Disabling full parallel sort"),
         COMPILER_SORT_SAMPLES(
                 POSITIVE_INTEGER,
@@ -104,11 +102,6 @@
         public Object defaultValue() {
             return defaultValue;
         }
-
-        @Override
-        public boolean hidden() {
-            return this == COMPILER_STRINGOFFSET;
-        }
     }
 
     public static final String COMPILER_SORTMEMORY_KEY = Option.COMPILER_SORTMEMORY.ini();
@@ -161,11 +154,6 @@
         return accessor.getInt(Option.COMPILER_PARALLELISM);
     }
 
-    public int getStringOffset() {
-        int value = accessor.getInt(Option.COMPILER_STRINGOFFSET);
-        return value > 0 ? 1 : 0;
-    }
-
     public boolean getSortParallel() {
         return accessor.getBoolean(Option.COMPILER_SORT_PARALLEL);
     }
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/TransactionProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/TransactionProperties.java
index 5ed069c..0de2c3d 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/TransactionProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/TransactionProperties.java
@@ -78,7 +78,7 @@
         TXN_JOB_RECOVERY_MEMORYSIZE(
                 LONG_BYTE_UNIT,
                 StorageUtil.getLongSizeInBytes(64L, MEGABYTE),
-                "The memory budget (in bytes) used for recovery");
+                "The memory budget for each job (in bytes) used for recovery");
 
         private final IOptionType type;
         private final Object defaultValue;
diff --git a/asterixdb/asterix-doc/src/main/markdown/builtins/2_string_common.md b/asterixdb/asterix-doc/src/main/markdown/builtins/2_string_common.md
index a7b9bbd..58d0e10 100644
--- a/asterixdb/asterix-doc/src/main/markdown/builtins/2_string_common.md
+++ b/asterixdb/asterix-doc/src/main/markdown/builtins/2_string_common.md
@@ -206,28 +206,36 @@
 
         position(string, string_pattern)
 
- * Returns the first position of `string_pattern` within `string`.
+ * Returns the first position of `string_pattern` within `string`. The function returns the 0-based position. Another
+ version of the function returns the 1-based position. Below are the aliases for each version:
+
+ * Aliases:
+    * 0-based: `position`, `pos`, `position0`, `pos0`.
+    * 1-based: `position1`, `pos1`.
+
  * Arguments:
-    * `string` : a `string` that might contain the pattern,
+    * `string` : a `string` that might contain the pattern.
     * `string_pattern` : a pattern `string` to be matched.
  * Return Value:
     * the first position that `string_pattern` appears within `string`
       (starting at 0), or -1 if it does not appear,
     * `missing` if any argument is a `missing` value,
     * `null` if any argument is a `null` value but no argument is a `missing` value,
-    * any other non-string input value will cause a type error.
+    * any other non-string input value will return a `null`.
 
  * Example:
 
         {
           "v1": position("ppphonepp", "phone"),
-          "v2": position("hone", "phone")
+          "v2": position("hone", "phone"),
+          "v3": position1("ppphonepp", "phone"),
+          "v4": position1("hone", "phone"),
         };
 
 
  * The expected result is:
 
-        { "v1": 3, "v2": -1 }
+        { "v1": 2, "v2": -1, v3": 3, "v4": -1 }
 
 
 ### regexp_contains ###
@@ -237,24 +245,27 @@
 
  * Checks whether the strings `string` contains the regular expression
     pattern `string_pattern` (a Java regular expression pattern).
+
+  * Aliases:
+      * `regexp_contains`, `regex_contains`, `contains_regexp`, `contains_regex`.
+
  * Arguments:
-    * `string` : a `string` that might contain the pattern,
-    * `string_pattern` : a pattern `string` to be matched,
+    * `string` : a `string` that might contain the pattern.
+    * `string_pattern` : a pattern `string` to be matched.
     * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching.
         * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).
  * Return Value:
-    * a `boolean`, returns `true` if `string` contains the pattern `string_pattern`,
-    * `missing` if any argument is a `missing` value,
-    * `null` if any argument is a `null` value but no argument is a `missing` value,
-    * any other non-string input value will cause a type error,
-    * `false` otherwise.
+    * a `boolean`, returns `true` if `string` contains the pattern `string_pattern`, `false` otherwise.
+    * `missing` if any argument is a `missing` value.
+    * `null` if any argument is a `null` value but no argument is a `missing` value.
+    * any other non-string input value will return a `null`.
 
  * Example:
 
         {
           "v1": regexp_contains("pphonepp", "p*hone"),
           "v2": regexp_contains("hone", "p+hone")
-        }
+        };
 
 
  * The expected result is:
@@ -269,17 +280,20 @@
 
  * Checks whether the string `string` exactly matches the regular expression pattern `string_pattern`
    (a Java regular expression pattern).
+
+ * Aliases:
+    * `regexp_like`, `regex_like`.
+
  * Arguments:
-    * `string` : a `string` that might contain the pattern,
-    * `string_pattern` : a pattern `string` that might be contained,
+    * `string` : a `string` that might contain the pattern.
+    * `string_pattern` : a pattern `string` that might be contained.
     * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching.
         * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).
  * Return Value:
-    * a `boolean` value, `true` if `string` contains the pattern `string_pattern`,
-    * `missing` if any argument is a `missing` value,
-    * `null` if any argument is a `null` value but no argument is a `missing` value,
-    * any other non-string input value will cause a type error,
-    * `false` otherwise.
+    * a `boolean` value, `true` if `string` contains the pattern `string_pattern`, `false` otherwise.
+    * `missing` if any argument is a `missing` value.
+    * `null` if any argument is a `null` value but no argument is a `missing` value.
+    * any other non-string input value will return a `null`.
 
  * Example:
 
@@ -298,11 +312,18 @@
 
         regexp_position(string, string_pattern[, string_flags])
 
- * Returns first position of the regular expression `string_pattern` (a Java regular expression pattern)
-   within `string`.
+ * Returns first position of the regular expression `string_pattern` (a Java regular expression pattern) within `string`.
+ The function returns the 0-based position. Another version of the function returns the 1-based position. Below are the
+ aliases for each version:
+
+ * Aliases:
+    * 0-Based: `regexp_position`, `regexp_pos`, `regexp_position0`, `regexp_pos0`, `regex_position`, `regex_pos`,
+    `regex_position0`, `regex_pos0`.
+    * 1-Based: `regexp_position1`, `regexp_pos1`, `regex_position1` `regex_pos1`.
+
  * Arguments:
-    * `string` : a `string` that might contain the pattern,
-    * `string_pattern` : a pattern `string` to be matched,
+    * `string` : a `string` that might contain the pattern.
+    * `string_pattern` : a pattern `string` to be matched.
     * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching.
         * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).
  * Return Value:
@@ -310,19 +331,20 @@
       (starting at 0), or -1 if it does not appear.
     * `missing` if any argument is a `missing` value,
     * `null` if any argument is a `null` value but no argument is a `missing` value,
-    * any other non-string input value will cause a type error.
+    * any other non-string input value will return a `null`.
 
  * Example:
 
         {
           "v1": regexp_position("pphonepp", "p*hone"),
-          "v2": regexp_position("hone", "p+hone")
+          "v2": regexp_position("hone", "p+hone"),
+          "v3": regexp_position1("pphonepp", "p*hone"),
+          "v4": regexp_position1("hone", "p+hone")
         };
 
-
  * The expected result is:
 
-        { "v1": 1, "v2": -1 }
+        { "v1": 0, "v2": -1, "v3": 1, "v4": -1 }
 
 
 ### regexp_replace ###
@@ -334,23 +356,27 @@
  * Checks whether the string `string` matches the given
    regular expression pattern `string_pattern` (a Java regular expression pattern),
    and replaces the matched pattern `string_pattern` with the new pattern `string_replacement`.
+
+ * Aliases:
+    * `regexp_replace`, `regex_replace`.
+
  * Arguments:
-    * `string` : a `string` that might contain the pattern,
-    * `string_pattern` : a pattern `string` to be matched,
-    * `string_replacement` : a pattern `string` to be used as the replacement,
+    * `string` : a `string` that might contain the pattern.
+    * `string_pattern` : a pattern `string` to be matched.
+    * `string_replacement` : a pattern `string` to be used as the replacement.
     * `string_flag` : (Optional) a `string` with flags to be used during replace.
         * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x).
     * `replacement_limit`: (Optional) an `integer` specifying the maximum number of replacements to make
          (if negative then all occurrences will be replaced)
  * Return Value:
-    * Returns a `string` that is obtained after the replacements,
-    * `missing` if any argument is a `missing` value,
-    * any other non-string input value will cause a type error,
+    * Returns a `string` that is obtained after the replacements.
+    * `missing` if any argument is a `missing` value.
     * `null` if any argument is a `null` value but no argument is a `missing` value.
+    * any other non-string input value will return a `null`.
 
  * Example:
 
-        regexp_replace(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a")
+        regexp_replace(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a");
 
 
  * The expected result is:
@@ -527,30 +553,37 @@
 
         substr(string, offset[, length])
 
- * Returns the substring from the given string `string` based on the given start offset `offset` with the optional `length`.
+ * Returns the substring from the given string `string` based on the given start offset `offset` with the optional `length`. 
+ The function uses the 0-based position. Another version of the function uses the 1-based position. Below are the
+ aliases for each version:
+
+ * Aliases:
+    * 0-Based: `substring`, `substr`, `substring0`, `substr0`.
+    * 1-Based: `substring1`, `substr1`.
+
  * Arguments:
-    * `string` : a `string` to be extracted,
+    * `string` : a `string` to be extracted.
     * `offset` : an `tinyint`/`smallint`/`integer`/`bigint` value as the starting offset of the substring in `string`
-                 (starting at 0). If negative then counted from the end of the string,
+                 (starting at 0). If negative then counted from the end of the string.
     * `length` : (Optional) an an `tinyint`/`smallint`/`integer`/`bigint` value as the length of the substring.
  * Return Value:
     * a `string` that represents the substring,
     * `missing` if any argument is a `missing` value,
     * `null` if any argument is a `null` value but no argument is a `missing` value, or if the substring could not
              be obtained because the starting offset is not within string bounds or `length` is negative.
-    * a type error will be raised if:
-        * the first argument is any other non-string value,
-        * or, the second argument is not a `tinyint`, `smallint`, `integer`, or `bigint`,
-        * or, the third argument is not a `tinyint`, `smallint`, `integer`, or `bigint` if the argument is present.
+    * a `null` will be returned if:
+        * the first argument is any other non-string value.
+        * the second argument is not a `tinyint`, `smallint`, `integer`, or `bigint`.
+        * the third argument is not a `tinyint`, `smallint`, `integer`, or `bigint` if the argument is present.
 
  * Example:
 
-        substr("test string", 6, 3);
+        { "v1": substr("test string", 6, 3), "v2": substr1("test string", 6, 3) };
 
 
  * The expected result is:
 
-        "str"
+        { "v1": "tri", "v2": "str" }
 
 The function has an alias `substring`.
 
diff --git a/asterixdb/asterix-doc/src/site/markdown/ncservice.md b/asterixdb/asterix-doc/src/site/markdown/ncservice.md
index 8d1a8cd..c996e23 100644
--- a/asterixdb/asterix-doc/src/site/markdown/ncservice.md
+++ b/asterixdb/asterix-doc/src/site/markdown/ncservice.md
@@ -365,7 +365,7 @@
 | common  | storage.max.active.writable.datasets      | The maximum number of datasets that can be concurrently modified | 8 |
 | common  | txn.commitprofiler.enabled                | Enable output of commit profiler logs | false |
 | common  | txn.commitprofiler.reportinterval         | Interval (in seconds) to report commit profiler logs | 5 |
-| common  | txn.job.recovery.memorysize               | The memory budget (in bytes) used for recovery | 67108864 (64 MB) |
+| common  | txn.job.recovery.memorysize               | The memory budget for each job job (in bytes) used for recovery | 67108864 (64 MB) |
 | common  | txn.lock.escalationthreshold              | The maximum number of entity locks to obtain before upgrading to a dataset lock | 1000 |
 | common  | txn.lock.shrinktimer                      | The time (in milliseconds) where under utilization of resources will trigger a shrink phase | 5000 |
 | common  | txn.lock.timeout.sweepthreshold           | Interval (in milliseconds) for checking lock timeout | 10000 |
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
index ee8308f..3af08fa 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
@@ -583,10 +583,20 @@
         public IJObject access(AListVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool,
                 IAType listType, JObjectPointableVisitor pointableVisitor) throws HyracksDataException {
             List<IVisitablePointable> items = pointable.getItems();
+            List<IVisitablePointable> itemTags = pointable.getItemTags();
             JList list = pointable.ordered() ? new JOrderedList(listType) : new JUnorderedList(listType);
             IJObject listItem;
-            for (IVisitablePointable itemPointable : items) {
-                final IAType fieldType = ((AbstractCollectionType) listType).getItemType();
+            for (int iter1 = 0; iter1 < items.size(); iter1++) {
+                IVisitablePointable itemPointable = items.get(iter1);
+                // First, try to get defined type.
+                IAType fieldType = ((AbstractCollectionType) listType).getItemType();
+                if (fieldType.getTypeTag() == ATypeTag.ANY) {
+                    // Second, if defined type is not available, try to infer it from data
+                    IVisitablePointable itemTagPointable = itemTags.get(iter1);
+                    ATypeTag itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                            .deserialize(itemTagPointable.getByteArray()[itemTagPointable.getStartOffset()]);
+                    fieldType = TypeTagUtil.getBuiltinTypeByTag(itemTypeTag);
+                }
                 typeInfo.reset(fieldType, fieldType.getTypeTag());
                 switch (typeInfo.getTypeTag()) {
                     case OBJECT:
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/ForClause.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/ForClause.java
index 9bae2a0..39ad04f 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/ForClause.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/ForClause.java
@@ -31,17 +31,14 @@
     private Expression inExpr = null;
 
     public ForClause() {
-        super();
     }
 
     public ForClause(VariableExpr varExpr, Expression inExpr) {
-        super();
         this.varExpr = varExpr;
         this.inExpr = inExpr;
     }
 
     public ForClause(VariableExpr varExpr, Expression inExpr, VariableExpr posExpr) {
-        super();
         this.varExpr = varExpr;
         this.inExpr = inExpr;
         this.posExpr = posExpr;
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/MetaVariableClause.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/MetaVariableClause.java
index 7712cf9..bbf7269 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/MetaVariableClause.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/clause/MetaVariableClause.java
@@ -27,6 +27,13 @@
 public class MetaVariableClause extends AbstractClause {
     private VarIdentifier var;
 
+    public MetaVariableClause() {
+    }
+
+    public MetaVariableClause(VarIdentifier var) {
+        this.var = var;
+    }
+
     @Override
     public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws CompilationException {
         return ((IAQLPlusVisitor<R, T>) visitor).visitMetaVariableClause(this, arg);
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/MetaVariableExpr.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/MetaVariableExpr.java
index 2964eff..fb03312 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/MetaVariableExpr.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/MetaVariableExpr.java
@@ -21,10 +21,15 @@
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.aql.visitor.base.IAQLPlusVisitor;
 import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 
 public class MetaVariableExpr extends VariableExpr {
 
+    public MetaVariableExpr(VarIdentifier var) {
+        super(var);
+    }
+
     @Override
     public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws CompilationException {
         return ((IAQLPlusVisitor<R, T>) visitor).visitMetaVariableExpr(this, arg);
diff --git a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
index 4c8820f..f8aa57c 100644
--- a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -152,6 +152,7 @@
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.common.util.RangeMapBuilder;
 import org.apache.asterix.metadata.utils.MetadataConstants;
+import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.common.utils.Triple;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -185,6 +186,8 @@
     // data generator hints
     private static final String DGEN_HINT = "dgen";
 
+    private static final String INT_TYPE_NAME = "int";
+
     private static class IndexParams {
       public IndexType type;
       public int gramLength;
@@ -798,15 +801,13 @@
 {
   <LEFTPAREN> (<VARIABLE>
     {
-      var = new VarIdentifier();
-      var.setValue(token.image);
+      var = new VarIdentifier(token.image);
       paramList.add(var);
       getCurrentScope().addNewVarSymbolToScope(var);
     }
   ( <COMMA> <VARIABLE>
     {
-      var = new VarIdentifier();
-      var.setValue(token.image);
+      var = new VarIdentifier(token.image);
       paramList.add(var);
       getCurrentScope().addNewVarSymbolToScope(var);
     }
@@ -1387,8 +1388,8 @@
 {
  id = QualifiedName()
    {
-     if (id.first == null && id.second.getValue().equalsIgnoreCase("int")) {
-        id.second.setValue("int64");
+     if (id.first == null && id.second.getValue().equalsIgnoreCase(INT_TYPE_NAME)) {
+        id.second = new Identifier(BuiltinType.AINT64.getTypeName());
      }
 
      return new TypeReferenceExpression(id);
@@ -1461,8 +1462,8 @@
         result.function  = third;
       }
 
-      if (result.function.equalsIgnoreCase("int")) {
-            result.function = "int64";
+      if (result.function.equalsIgnoreCase(INT_TYPE_NAME)) {
+        result.function = BuiltinType.AINT64.getTypeName();
       }
       return result;
     }
@@ -2077,8 +2078,6 @@
 
 VariableExpr VariableRef() throws ParseException:
 {
-    VariableExpr varExp = new VariableExpr();
-    VarIdentifier var = new VarIdentifier();
 }
 {
   <VARIABLE>
@@ -2088,13 +2087,13 @@
      if (isInForbiddenScopes(varName)) {
        throw new ParseException("Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
      }
+     VariableExpr varExp;
      if(ident != null) { // exist such ident
+       varExp = new VariableExpr((VarIdentifier)ident);
        varExp.setIsNewVar(false);
-       varExp.setVar((VarIdentifier)ident);
      } else {
-       varExp.setVar(var);
+       varExp = new VariableExpr(new VarIdentifier(varName));
      }
-     var.setValue(varName);
      return varExp;
     }
 }
@@ -2102,18 +2101,16 @@
 
 VariableExpr Variable() throws ParseException:
 {
-    VariableExpr varExp = new VariableExpr();
-    VarIdentifier var = new VarIdentifier();
 }
 {
   <VARIABLE>
     {
-     Identifier ident = lookupSymbol(token.image);
+     String varName = token.image;
+     Identifier ident = lookupSymbol(varName);
+     VariableExpr varExp = new VariableExpr(new VarIdentifier(varName));
      if(ident != null) { // exist such ident
        varExp.setIsNewVar(false);
      }
-     varExp.setVar(var);
-     var.setValue(token.image);
      return varExp;
     }
 }
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
index 17d0d2f..3ed3221 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
@@ -29,11 +29,6 @@
     private VarIdentifier var;
     private boolean isNewVar;
 
-    public VariableExpr() {
-        super();
-        isNewVar = true;
-    }
-
     public VariableExpr(VarIdentifier var) {
         super();
         this.var = var;
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DatasetDecl.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DatasetDecl.java
index 0a17b24..ac019fc 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DatasetDecl.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/statement/DatasetDecl.java
@@ -101,16 +101,12 @@
         }
     }
 
-    public Identifier getMetaName() {
-        return name;
-    }
-
     public Identifier getMetaItemTypeName() {
-        return metaItemTypeName == null ? new Identifier() : metaItemTypeName;
+        return metaItemTypeName;
     }
 
     public Identifier getMetaItemTypeDataverse() {
-        return metaItemTypeDataverse == null ? new Identifier() : metaItemTypeDataverse;
+        return metaItemTypeDataverse;
     }
 
     public String getQualifiedMetaTypeName() {
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/Identifier.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/Identifier.java
index 1443833..7f8171c 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/Identifier.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/Identifier.java
@@ -21,11 +21,8 @@
 import java.util.Objects;
 
 public class Identifier {
-    protected String value;
 
-    public Identifier() {
-        // default constructor.
-    }
+    protected final String value;
 
     public Identifier(String value) {
         this.value = value;
@@ -35,10 +32,6 @@
         return value;
     }
 
-    public final void setValue(String value) {
-        this.value = value;
-    }
-
     @Override
     public String toString() {
         return value;
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
index 587dd1c..4fea88b 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/struct/VarIdentifier.java
@@ -21,10 +21,8 @@
 import java.util.Objects;
 
 public final class VarIdentifier extends Identifier {
-    private int id = 0;
 
-    public VarIdentifier() {
-    }
+    private int id;
 
     public VarIdentifier(VarIdentifier v) {
         this(v.getValue(), v.getId());
@@ -35,7 +33,7 @@
     }
 
     public VarIdentifier(String value, int id) {
-        this.value = value;
+        super(value);
         this.id = id;
     }
 
@@ -48,11 +46,6 @@
     }
 
     @Override
-    public VarIdentifier clone() {
-        return new VarIdentifier(value, id);
-    }
-
-    @Override
     public int hashCode() {
         return Objects.hash(value);
     }
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
index 202fe4e..7701502 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/CommonFunctionMapUtil.java
@@ -37,7 +37,6 @@
         addFunctionMapping("substr", "substring"); // substr,  internal: substring
         addFunctionMapping("upper", "uppercase"); // upper, internal: uppercase
         addFunctionMapping("title", "initcap"); // title, internal: initcap
-        addFunctionMapping("regexp_contains", "matches"); // regexp_contains, internal: matches
         addFunctionMapping("int", "integer"); // int, internal: integer
 
         // The "mapped-to" names are to be deprecated.
@@ -46,6 +45,32 @@
         addFunctionMapping("integer", "int32"); // integer, internal: int32
         addFunctionMapping("bigint", "int64"); // bigint, internal: int64
 
+        // String functions
+        addFunctionMapping("pos", "position");
+        addFunctionMapping("pos0", "position");
+        addFunctionMapping("position0", "position");
+        addFunctionMapping("pos1", "position1");
+        addFunctionMapping("substr", "substring");
+        addFunctionMapping("substr0", "substring");
+        addFunctionMapping("substring0", "substring");
+        addFunctionMapping("substr1", "substring1");
+        addFunctionMapping("regex_contains", "matches");
+        addFunctionMapping("contains_regex", "matches");
+        addFunctionMapping("regexp_contains", "matches");
+        addFunctionMapping("contains_regexp", "matches");
+        addFunctionMapping("regex_like", "regexp-like");
+        addFunctionMapping("regex_pos", "regexp-position");
+        addFunctionMapping("regex_position", "regexp-position");
+        addFunctionMapping("regex_pos0", "regexp-position");
+        addFunctionMapping("regex_position0", "regexp-position");
+        addFunctionMapping("regexp_pos", "regexp-position");
+        addFunctionMapping("regexp_pos0", "regexp-position");
+        addFunctionMapping("regexp_position0", "regexp-position");
+        addFunctionMapping("regex_pos1", "regexp-position1");
+        addFunctionMapping("regex_position1", "regexp-position1");
+        addFunctionMapping("regexp_pos1", "regexp-position1");
+        addFunctionMapping("regex_replace", "regexp-replace");
+
         // Type functions.
         addFunctionMapping("isnull", "is-null"); // isnull, internal: is-null
         addFunctionMapping("ismissing", "is-missing"); // ismissing, internal: is-missing
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/ExpressionToVariableUtil.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/ExpressionToVariableUtil.java
index d8534be..21ae883 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/ExpressionToVariableUtil.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/ExpressionToVariableUtil.java
@@ -96,8 +96,7 @@
         try {
             String varName = getGeneratedIdentifier(expr);
             VarIdentifier var = new VarIdentifier(varName);
-            VariableExpr varExpr = new VariableExpr();
-            varExpr.setVar(var);
+            VariableExpr varExpr = new VariableExpr(var);
             varExpr.setSourceLocation(expr.getSourceLocation());
             return varExpr;
         } catch (ParseException e) {
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index e0a4341..38ace29 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -181,6 +181,7 @@
 import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
 import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.types.BuiltinType;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -217,6 +218,8 @@
     private static final String TIES = "TIES";
     private static final String UNBOUNDED = "UNBOUNDED";
 
+    private static final String INT_TYPE_NAME = "int";
+
     // error configuration
     protected static final boolean REPORT_EXPECTED_TOKENS = false;
 
@@ -1645,8 +1648,8 @@
 {
   id = QualifiedName()
   {
-    if (id.first == null && id.second.getValue().equalsIgnoreCase("int")) {
-      id.second.setValue("int64");
+    if (id.first == null && id.second.getValue().equalsIgnoreCase(INT_TYPE_NAME)) {
+      id.second = new Identifier(BuiltinType.AINT64.getTypeName());
     }
 
     TypeReferenceExpression typeRef = new TypeReferenceExpression(id);
@@ -1728,8 +1731,8 @@
         result.function  = third;
       }
 
-      if (result.function.equalsIgnoreCase("int")) {
-            result.function = "int64";
+      if (result.function.equalsIgnoreCase(INT_TYPE_NAME)) {
+         result.function = BuiltinType.AINT64.getTypeName();
       }
       return result;
     }
@@ -2565,7 +2568,6 @@
 
 VariableExpr VariableRef() throws ParseException:
 {
-    VarIdentifier var = new VarIdentifier();
     String id = null;
 }
 {
@@ -2577,13 +2579,12 @@
        throw new SqlppParseException(getSourceLocation(token),
         "Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.");
      }
-     VariableExpr varExp = new VariableExpr();
+     VariableExpr varExp;
      if (ident != null) { // exist such ident
-       varExp.setVar((VarIdentifier)ident);
+       varExp = new VariableExpr((VarIdentifier)ident);
      } else {
-       varExp.setVar(var);
+       varExp = new VariableExpr(new VarIdentifier(id));
        varExp.setIsNewVar(false);
-       var.setValue(id);
      }
      return addSourceLocation(varExp, token);
     }
@@ -2591,7 +2592,6 @@
 
 VariableExpr Variable() throws ParseException:
 {
-    VarIdentifier var = new VarIdentifier();
     String id = null;
 }
 {
@@ -2599,12 +2599,10 @@
     {
      id = SqlppVariableUtil.toInternalVariableName(id); // prefix user-defined variables with "$".
      Identifier ident = lookupSymbol(id);
-     VariableExpr varExp = new VariableExpr();
-     if(ident != null) { // exist such ident
+     VariableExpr varExp = new VariableExpr(new VarIdentifier(id));
+     if (ident != null) { // exist such ident
        varExp.setIsNewVar(false);
      }
-     varExp.setVar(var);
-     var.setValue(id);
      return addSourceLocation(varExp, token);
     }
 }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
index bf2709a..1397b1a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
@@ -432,8 +432,12 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-like", 3);
     public static final FunctionIdentifier STRING_REGEXP_POSITION =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-position", 2);
+    public static final FunctionIdentifier STRING_REGEXP_POSITION_OFFSET_1 =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-position1", 2);
     public static final FunctionIdentifier STRING_REGEXP_POSITION_WITH_FLAG =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-position", 3);
+    public static final FunctionIdentifier STRING_REGEXP_POSITION_OFFSET_1_WITH_FLAG =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-position1", 3);
     public static final FunctionIdentifier STRING_REGEXP_REPLACE =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "regexp-replace", 3);
     public static final FunctionIdentifier STRING_REGEXP_REPLACE_WITH_FLAG =
@@ -458,6 +462,8 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "rtrim", 2);
     public static final FunctionIdentifier STRING_POSITION =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "position", 2);
+    public static final FunctionIdentifier STRING_POSITION_OFFSET_1 =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "position1", 2);
     public static final FunctionIdentifier STRING_REPLACE =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "replace", 3);
     public static final FunctionIdentifier STRING_REPLACE_WITH_LIMIT =
@@ -476,8 +482,12 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "ends-with", 2);
     public static final FunctionIdentifier SUBSTRING =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "substring", 3);
+    public static final FunctionIdentifier SUBSTRING_OFFSET_1 =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "substring1", 3);
     public static final FunctionIdentifier SUBSTRING2 =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "substring", 2);
+    public static final FunctionIdentifier SUBSTRING2_OFFSET_1 =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "substring1", 2);
     public static final FunctionIdentifier SUBSTRING_BEFORE =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "substring-before", 2);
     public static final FunctionIdentifier SUBSTRING_AFTER =
@@ -1704,7 +1714,9 @@
         addFunction(CODEPOINT_TO_STRING, AStringTypeComputer.INSTANCE, true); // TODO
         addFunction(STRING_CONCAT, ConcatTypeComputer.INSTANCE_STRING, true); // TODO
         addFunction(SUBSTRING, SubstringTypeComputer.INSTANCE, true); // TODO
+        addFunction(SUBSTRING_OFFSET_1, SubstringTypeComputer.INSTANCE, true); // TODO
         addFunction(SUBSTRING2, AStringTypeComputer.INSTANCE_NULLABLE, true);
+        addFunction(SUBSTRING2_OFFSET_1, AStringTypeComputer.INSTANCE_NULLABLE, true);
         addFunction(STRING_LENGTH, UnaryStringInt64TypeComputer.INSTANCE, true);
         addFunction(STRING_LOWERCASE, StringStringTypeComputer.INSTANCE, true);
         addFunction(STRING_UPPERCASE, StringStringTypeComputer.INSTANCE, true);
@@ -1716,6 +1728,7 @@
         addFunction(STRING_LTRIM2, StringStringTypeComputer.INSTANCE, true);
         addFunction(STRING_RTRIM2, StringStringTypeComputer.INSTANCE, true);
         addFunction(STRING_POSITION, StringInt32TypeComputer.INSTANCE, true);
+        addFunction(STRING_POSITION_OFFSET_1, StringInt32TypeComputer.INSTANCE, true);
         addFunction(STRING_STARTS_WITH, StringBooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_ENDS_WITH, StringBooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_MATCHES, StringBooleanTypeComputer.INSTANCE, true);
@@ -1723,7 +1736,9 @@
         addFunction(STRING_REGEXP_LIKE, StringBooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_REGEXP_LIKE_WITH_FLAG, StringBooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_REGEXP_POSITION, StringInt32TypeComputer.INSTANCE, true);
+        addFunction(STRING_REGEXP_POSITION_OFFSET_1, StringInt32TypeComputer.INSTANCE, true);
         addFunction(STRING_REGEXP_POSITION_WITH_FLAG, StringInt32TypeComputer.INSTANCE, true);
+        addFunction(STRING_REGEXP_POSITION_OFFSET_1_WITH_FLAG, StringInt32TypeComputer.INSTANCE, true);
         addFunction(STRING_REGEXP_REPLACE, StringStringTypeComputer.INSTANCE, true);
         addFunction(STRING_REGEXP_REPLACE_WITH_FLAG, AStringTypeComputer.INSTANCE_NULLABLE, true);
         addFunction(STRING_REPLACE, StringStringTypeComputer.INSTANCE, true);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringOffsetConfigurableDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringOffsetConfigurableDescriptor.java
deleted file mode 100644
index 3f8f45f..0000000
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringOffsetConfigurableDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.runtime.evaluators.functions;
-
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-
-public abstract class AbstractStringOffsetConfigurableDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-
-    protected int stringOffset;
-
-    @Override
-    public void setImmutableStates(Object... states) {
-        stringOffset = (int) states[0];
-    }
-}
\ No newline at end of file
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
index 3391b74..f7177fd 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionDescriptor.java
@@ -19,14 +19,10 @@
 
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -35,37 +31,24 @@
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 @MissingNullInOutFunction
-public class StringPositionDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class StringPositionDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringPositionDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringPositionDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
                 return new AbstractBinaryStringIntEval(ctx, args[0], args[1],
                         StringPositionDescriptor.this.getIdentifier(), sourceLoc) {
 
                     @Override
-                    protected int compute(UTF8StringPointable left, UTF8StringPointable right) throws IOException {
-                        int pos = UTF8StringPointable.find(left, right, false);
-                        return pos < 0 ? pos : pos + baseOffset;
+                    protected int compute(UTF8StringPointable left, UTF8StringPointable right) {
+                        return UTF8StringPointable.find(left, right, false);
                     }
                 };
             }
@@ -76,5 +59,4 @@
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.STRING_POSITION;
     }
-
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionOffset1Descriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionOffset1Descriptor.java
new file mode 100644
index 0000000..10cc779
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringPositionOffset1Descriptor.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+@MissingNullInOutFunction
+public class StringPositionOffset1Descriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = StringPositionOffset1Descriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractBinaryStringIntEval(ctx, args[0], args[1],
+                        StringPositionOffset1Descriptor.this.getIdentifier(), sourceLoc) {
+
+                    @Override
+                    protected int compute(UTF8StringPointable left, UTF8StringPointable right) {
+                        int pos = UTF8StringPointable.find(left, right, false);
+                        return pos < 0 ? pos : pos + 1;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_POSITION_OFFSET_1;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsDescriptor.java
index 1d1d011..abeaf9f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsDescriptor.java
@@ -20,7 +20,6 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
@@ -35,12 +34,7 @@
 public class StringRegExpContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringRegExpContainsDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpContainsDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsWithFlagDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsWithFlagDescriptor.java
index 7016581..5f6e782 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsWithFlagDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpContainsWithFlagDescriptor.java
@@ -24,7 +24,6 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
@@ -39,12 +38,7 @@
 public class StringRegExpContainsWithFlagDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringRegExpContainsWithFlagDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpContainsWithFlagDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
index bfdcb1e..c84c62d 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionDescriptor.java
@@ -21,11 +21,9 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -34,28 +32,16 @@
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 @MissingNullInOutFunction
-public class StringRegExpPositionDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class StringRegExpPositionDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringRegExpPositionDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpPositionDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
                 return new AbstractBinaryStringIntEval(ctx, args[0], args[1],
@@ -66,8 +52,7 @@
                     protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr)
                             throws HyracksDataException {
                         matcher.build(srcPtr, patternPtr);
-                        int pos = matcher.position();
-                        return pos < 0 ? pos : pos + baseOffset;
+                        return matcher.position();
                     }
                 };
             }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1Descriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1Descriptor.java
new file mode 100644
index 0000000..dd6925c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1Descriptor.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+@MissingNullInOutFunction
+public class StringRegExpPositionOffset1Descriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpPositionOffset1Descriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractBinaryStringIntEval(ctx, args[0], args[1],
+                        StringRegExpPositionOffset1Descriptor.this.getIdentifier(), sourceLoc) {
+                    private final RegExpMatcher matcher = new RegExpMatcher();
+
+                    @Override
+                    protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr)
+                            throws HyracksDataException {
+                        matcher.build(srcPtr, patternPtr);
+                        int pos = matcher.position();
+                        return pos < 0 ? pos : pos + 1;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_REGEXP_POSITION_OFFSET_1;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1WithFlagDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1WithFlagDescriptor.java
new file mode 100644
index 0000000..f0c8181
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionOffset1WithFlagDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+@MissingNullInOutFunction
+public class StringRegExpPositionOffset1WithFlagDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpPositionOffset1WithFlagDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTripleStringIntEval(ctx, args[0], args[1], args[2],
+                        StringRegExpPositionOffset1WithFlagDescriptor.this.getIdentifier(), sourceLoc) {
+                    private final RegExpMatcher matcher = new RegExpMatcher();
+
+                    @Override
+                    protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr,
+                            UTF8StringPointable flagPtr) throws HyracksDataException {
+                        matcher.build(srcPtr, patternPtr, flagPtr);
+                        int pos = matcher.position();
+                        return pos < 0 ? pos : pos + 1;
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_REGEXP_POSITION_OFFSET_1_WITH_FLAG;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
index 339b989..8dfd2a1 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpPositionWithFlagDescriptor.java
@@ -21,11 +21,9 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -34,28 +32,16 @@
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 @MissingNullInOutFunction
-public class StringRegExpPositionWithFlagDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class StringRegExpPositionWithFlagDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringRegExpPositionWithFlagDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpPositionWithFlagDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
                 return new AbstractTripleStringIntEval(ctx, args[0], args[1], args[2],
@@ -66,8 +52,7 @@
                     protected int compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr,
                             UTF8StringPointable flagPtr) throws HyracksDataException {
                         matcher.build(srcPtr, patternPtr, flagPtr);
-                        int pos = matcher.position();
-                        return pos < 0 ? pos : pos + baseOffset;
+                        return matcher.position();
                     }
                 };
             }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpReplaceDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpReplaceDescriptor.java
index 9819d63..de32e12 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpReplaceDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringRegExpReplaceDescriptor.java
@@ -20,7 +20,6 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.utils.RegExpMatcher;
@@ -35,12 +34,7 @@
 public class StringRegExpReplaceDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringRegExpReplaceDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = StringRegExpReplaceDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
index 41ae0c3..2ceca76 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
@@ -18,103 +18,29 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.om.base.AMutableInt32;
-import org.apache.asterix.om.exceptions.ExceptionUtil;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.runtime.evaluators.common.ArgumentUtils;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
-import org.apache.asterix.runtime.utils.DescriptorFactoryUtil;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.GrowableArray;
-import org.apache.hyracks.data.std.util.UTF8StringBuilder;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class Substring2Descriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class Substring2Descriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY =
-            DescriptorFactoryUtil.createFactory(Substring2Descriptor::new, FunctionTypeInferers.SET_STRING_OFFSET);
+    public static final IFunctionDescriptorFactory FACTORY = Substring2Descriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
-                return new IScalarEvaluator() {
-                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
-                    private final DataOutput out = resultStorage.getDataOutput();
-                    private final IPointable argString = new VoidPointable();
-                    private final IPointable argStart = new VoidPointable();
-                    private final IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
-                    private final IScalarEvaluator evalStart = args[1].createScalarEvaluator(ctx);
-                    private final GrowableArray array = new GrowableArray();
-                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
-                    private final UTF8StringPointable string = new UTF8StringPointable();
-                    private final FunctionIdentifier funID = getIdentifier();
-                    private final AMutableInt32 mutableInt = new AMutableInt32(0);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
-                        resultStorage.reset();
-                        evalString.evaluate(tuple, argString);
-                        evalStart.evaluate(tuple, argStart);
-
-                        if (PointableHelper.checkAndSetMissingOrNull(result, argString, argStart)) {
-                            return;
-                        }
-
-                        byte[] bytes = argStart.getByteArray();
-                        int offset = argStart.getStartOffset();
-                        // check that the int argument is numeric without fractions (in case arg is double or float)
-                        if (!ArgumentUtils.checkWarnOrSetInteger(ctx, sourceLoc, funID, 1, bytes, offset, mutableInt)) {
-                            PointableHelper.setNull(result);
-                            return;
-                        }
-                        int start = mutableInt.getIntegerValue();
-                        bytes = argString.getByteArray();
-                        offset = argString.getStartOffset();
-                        int len = argString.getLength();
-                        if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            PointableHelper.setNull(result);
-                            ExceptionUtil.warnTypeMismatch(ctx, sourceLoc, funID, bytes[offset], 0, ATypeTag.STRING);
-                            return;
-                        }
-                        string.set(bytes, offset + 1, len - 1);
-                        array.reset();
-                        try {
-                            int actualStart = start >= 0 ? start - baseOffset : string.getStringLength() + start;
-                            boolean success =
-                                    UTF8StringPointable.substr(string, actualStart, Integer.MAX_VALUE, builder, array);
-                            if (success) {
-                                out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
-                                out.write(array.getByteArray(), 0, array.getLength());
-                                result.set(resultStorage);
-                            } else {
-                                PointableHelper.setNull(result);
-                            }
-                        } catch (IOException e) {
-                            throw HyracksDataException.create(e);
-                        }
-                    }
-                };
+                return new Substring2Eval(ctx, args, getIdentifier(), sourceLoc, 0);
             }
         };
     }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Eval.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Eval.java
new file mode 100644
index 0000000..55cacb9
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Eval.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.base.AMutableInt32;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.common.ArgumentUtils;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+@MissingNullInOutFunction
+class Substring2Eval extends AbstractScalarEval {
+
+    private final IEvaluatorContext context;
+
+    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private final DataOutput out = resultStorage.getDataOutput();
+    private final IPointable argString = new VoidPointable();
+    private final IPointable argStart = new VoidPointable();
+    private final IScalarEvaluator evalString;
+    private final IScalarEvaluator evalStart;
+    private final GrowableArray array = new GrowableArray();
+    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+    private final UTF8StringPointable string = new UTF8StringPointable();
+    private final AMutableInt32 mutableInt = new AMutableInt32(0);
+
+    private final int baseOffset;
+
+    Substring2Eval(IEvaluatorContext context, IScalarEvaluatorFactory[] args, FunctionIdentifier functionIdentifier,
+            SourceLocation sourceLoc, int baseOffset) throws HyracksDataException {
+        super(sourceLoc, functionIdentifier);
+        this.context = context;
+        this.baseOffset = baseOffset;
+        evalString = args[0].createScalarEvaluator(context);
+        evalStart = args[1].createScalarEvaluator(context);
+    }
+
+    @Override
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+        resultStorage.reset();
+        evalString.evaluate(tuple, argString);
+        evalStart.evaluate(tuple, argStart);
+
+        if (PointableHelper.checkAndSetMissingOrNull(result, argString, argStart)) {
+            return;
+        }
+
+        byte[] bytes = argStart.getByteArray();
+        int offset = argStart.getStartOffset();
+        // check that the int argument is numeric without fractions (in case arg is double or float)
+        if (!ArgumentUtils.checkWarnOrSetInteger(context, sourceLoc, functionIdentifier, 1, bytes, offset,
+                mutableInt)) {
+            PointableHelper.setNull(result);
+            return;
+        }
+        int start = mutableInt.getIntegerValue();
+        bytes = argString.getByteArray();
+        offset = argString.getStartOffset();
+        int len = argString.getLength();
+        if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            PointableHelper.setNull(result);
+            ExceptionUtil.warnTypeMismatch(context, sourceLoc, functionIdentifier, bytes[offset], 0, ATypeTag.STRING);
+            return;
+        }
+        string.set(bytes, offset + 1, len - 1);
+        array.reset();
+        try {
+            int actualStart = start >= 0 ? start - baseOffset : string.getStringLength() + start;
+            boolean success = UTF8StringPointable.substr(string, actualStart, Integer.MAX_VALUE, builder, array);
+            if (success) {
+                out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
+                out.write(array.getByteArray(), 0, array.getLength());
+                result.set(resultStorage);
+            } else {
+                PointableHelper.setNull(result);
+            }
+        } catch (IOException e) {
+            throw HyracksDataException.create(e);
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Offset1Descriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Offset1Descriptor.java
new file mode 100644
index 0000000..9d8d1b8
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Offset1Descriptor.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+@MissingNullInOutFunction
+public class Substring2Offset1Descriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = Substring2Offset1Descriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
+                return new Substring2Eval(ctx, args, getIdentifier(), sourceLoc, 1);
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.SUBSTRING2_OFFSET_1;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
index 0dd2561..d1f8c3f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
@@ -18,115 +18,31 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.GrowableArray;
-import org.apache.hyracks.data.std.util.UTF8StringBuilder;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class SubstringDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class SubstringDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubstringDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = SubstringDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
-                return new IScalarEvaluator() {
-
-                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
-                    private final DataOutput out = resultStorage.getDataOutput();
-                    private IPointable argString = new VoidPointable();
-                    private IPointable argStart = new VoidPointable();
-                    private IPointable argLen = new VoidPointable();
-                    private final IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
-                    private final IScalarEvaluator evalStart = args[1].createScalarEvaluator(ctx);
-                    private final IScalarEvaluator evalLen = args[2].createScalarEvaluator(ctx);
-
-                    private final GrowableArray array = new GrowableArray();
-                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
-                    private final UTF8StringPointable string = new UTF8StringPointable();
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
-                        resultStorage.reset();
-                        evalString.evaluate(tuple, argString);
-                        evalStart.evaluate(tuple, argStart);
-                        evalLen.evaluate(tuple, argLen);
-
-                        if (PointableHelper.checkAndSetMissingOrNull(result, argString, argStart, argLen)) {
-                            return;
-                        }
-
-                        byte[] bytes = argStart.getByteArray();
-                        int offset = argStart.getStartOffset();
-                        int start = ATypeHierarchy.getIntegerValue(getIdentifier().getName(), 0, bytes, offset);
-
-                        bytes = argLen.getByteArray();
-                        offset = argLen.getStartOffset();
-                        int len = ATypeHierarchy.getIntegerValue(getIdentifier().getName(), 1, bytes, offset);
-
-                        bytes = argString.getByteArray();
-                        offset = argString.getStartOffset();
-                        int length = argString.getLength();
-                        if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes[offset],
-                                    ATypeTag.SERIALIZED_STRING_TYPE_TAG);
-                        }
-                        string.set(bytes, offset + 1, length - 1);
-                        array.reset();
-                        try {
-                            int actualStart = start >= 0 ? start - baseOffset : string.getStringLength() + start;
-                            boolean success = UTF8StringPointable.substr(string, actualStart, len, builder, array);
-                            if (success) {
-                                out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
-                                out.write(array.getByteArray(), 0, array.getLength());
-                                result.set(resultStorage);
-                            } else {
-                                PointableHelper.setNull(result);
-                            }
-                        } catch (IOException e) {
-                            throw HyracksDataException.create(e);
-                        }
-                    }
-                };
+                return new SubstringEval(ctx, args, getIdentifier(), sourceLoc, 0);
             }
         };
     }
@@ -135,5 +51,4 @@
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.SUBSTRING;
     }
-
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringEval.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringEval.java
new file mode 100644
index 0000000..993f5e6
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringEval.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+@MissingNullInOutFunction
+class SubstringEval extends AbstractScalarEval {
+
+    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private final DataOutput out = resultStorage.getDataOutput();
+    private IPointable argString = new VoidPointable();
+    private IPointable argStart = new VoidPointable();
+    private IPointable argLen = new VoidPointable();
+    private final IScalarEvaluator evalString;
+    private final IScalarEvaluator evalStart;
+    private final IScalarEvaluator evalLen;
+    private final int baseOffset;
+
+    private final GrowableArray array = new GrowableArray();
+    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+    private final UTF8StringPointable string = new UTF8StringPointable();
+
+    SubstringEval(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args, FunctionIdentifier functionIdentifier,
+            SourceLocation sourceLoc, int baseOffset) throws HyracksDataException {
+        super(sourceLoc, functionIdentifier);
+
+        evalString = args[0].createScalarEvaluator(ctx);
+        evalStart = args[1].createScalarEvaluator(ctx);
+        evalLen = args[2].createScalarEvaluator(ctx);
+
+        this.baseOffset = baseOffset;
+    }
+
+    @Override
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
+        resultStorage.reset();
+        evalString.evaluate(tuple, argString);
+        evalStart.evaluate(tuple, argStart);
+        evalLen.evaluate(tuple, argLen);
+
+        if (PointableHelper.checkAndSetMissingOrNull(result, argString, argStart, argLen)) {
+            return;
+        }
+
+        byte[] bytes = argStart.getByteArray();
+        int offset = argStart.getStartOffset();
+        int start = ATypeHierarchy.getIntegerValue(functionIdentifier.getName(), 0, bytes, offset);
+
+        bytes = argLen.getByteArray();
+        offset = argLen.getStartOffset();
+        int len = ATypeHierarchy.getIntegerValue(functionIdentifier.getName(), 1, bytes, offset);
+
+        bytes = argString.getByteArray();
+        offset = argString.getStartOffset();
+        int length = argString.getLength();
+        if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            throw new TypeMismatchException(sourceLoc, functionIdentifier, 0, bytes[offset],
+                    ATypeTag.SERIALIZED_STRING_TYPE_TAG);
+        }
+        string.set(bytes, offset + 1, length - 1);
+        array.reset();
+        try {
+            int actualStart = start >= 0 ? start - baseOffset : string.getStringLength() + start;
+            boolean success = UTF8StringPointable.substr(string, actualStart, len, builder, array);
+            if (success) {
+                out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
+                out.write(array.getByteArray(), 0, array.getLength());
+                result.set(resultStorage);
+            } else {
+                PointableHelper.setNull(result);
+            }
+        } catch (IOException e) {
+            throw HyracksDataException.create(e);
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringOffset1Descriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringOffset1Descriptor.java
new file mode 100644
index 0000000..6eda0ad
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringOffset1Descriptor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+@MissingNullInOutFunction
+public class SubstringOffset1Descriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = SubstringOffset1Descriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
+                return new SubstringEval(ctx, args, getIdentifier(), sourceLoc, 1);
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.SUBSTRING_OFFSET_1;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractFindBinaryEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractFindBinaryEvaluator.java
index 3ab47ee..56ceb49 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractFindBinaryEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractFindBinaryEvaluator.java
@@ -38,7 +38,6 @@
 public abstract class AbstractFindBinaryEvaluator extends AbstractBinaryScalarEvaluator {
 
     private static final ATypeTag[] EXPECTED_INPUT_TAG = { ATypeTag.BINARY, ATypeTag.BINARY };
-    protected final int baseOffset;
     protected final AMutableInt64 result = new AMutableInt64(-1);
     protected final ByteArrayPointable textPtr = new ByteArrayPointable();
     protected final ByteArrayPointable wordPtr = new ByteArrayPointable();
@@ -48,9 +47,8 @@
             SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT64);
 
     public AbstractFindBinaryEvaluator(IEvaluatorContext context, IScalarEvaluatorFactory[] copyEvaluatorFactories,
-            int baseOffset, FunctionIdentifier funcId, SourceLocation sourceLoc) throws HyracksDataException {
+            FunctionIdentifier funcId, SourceLocation sourceLoc) throws HyracksDataException {
         super(context, copyEvaluatorFactories, funcId, sourceLoc);
-        this.baseOffset = baseOffset;
     }
 
     @Override
@@ -85,7 +83,7 @@
         wordPtr.set(pointables[1].getByteArray(), pointables[0].getStartOffset() + 1, pointables[1].getLength() - 1);
         int pos = indexOf(textPtr.getByteArray(), textPtr.getContentStartOffset(), textPtr.getContentLength(),
                 wordPtr.getByteArray(), wordPtr.getContentStartOffset(), wordPtr.getContentLength(), fromOffset);
-        result.setValue(pos < 0 ? pos : pos + baseOffset);
+        result.setValue(pos);
         intSerde.serialize(result, dataOutput);
         resultPointable.set(resultStorage);
     }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractSubBinaryEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractSubBinaryEvaluator.java
index 345f753..078d2bd 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractSubBinaryEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractSubBinaryEvaluator.java
@@ -39,14 +39,12 @@
 
     private ByteArrayPointable byteArrayPointable = new ByteArrayPointable();
     private byte[] metaBuffer = new byte[5];
-    protected final int baseOffset;
 
     private static final ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.BINARY, ATypeTag.INTEGER };
 
     public AbstractSubBinaryEvaluator(IEvaluatorContext context, IScalarEvaluatorFactory[] copyEvaluatorFactories,
-            int baseOffset, FunctionIdentifier funcId, SourceLocation sourceLoc) throws HyracksDataException {
+            FunctionIdentifier funcId, SourceLocation sourceLoc) throws HyracksDataException {
         super(context, copyEvaluatorFactories, funcId, sourceLoc);
-        this.baseOffset = baseOffset;
     }
 
     @Override
@@ -86,8 +84,7 @@
 
             int subStart;
 
-            subStart = ATypeHierarchy.getIntegerValue(BuiltinFunctions.SUBBINARY_FROM.getName(), 1, startBytes, offset)
-                    - baseOffset;
+            subStart = ATypeHierarchy.getIntegerValue(BuiltinFunctions.SUBBINARY_FROM.getName(), 1, startBytes, offset);
 
             int totalLength = byteArrayPointable.getContentLength();
             int subLength = getSubLength(tuple);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
index 54b146f..c59699f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
@@ -21,11 +21,8 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
-import org.apache.asterix.runtime.evaluators.functions.AbstractStringOffsetConfigurableDescriptor;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -34,19 +31,9 @@
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class FindBinaryDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class FindBinaryDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new FindBinaryDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = FindBinaryDescriptor::new;
 
     @Override
     public FunctionIdentifier getIdentifier() {
@@ -58,11 +45,9 @@
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractFindBinaryEvaluator(ctx, args, baseOffset, getIdentifier(), sourceLoc) {
+                return new AbstractFindBinaryEvaluator(ctx, args, getIdentifier(), sourceLoc) {
                     @Override
                     protected int getFromOffset(IFrameTupleReference tuple) {
                         return 0;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
index 80ffbca..a573394 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
@@ -21,12 +21,9 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
-import org.apache.asterix.runtime.evaluators.functions.AbstractStringOffsetConfigurableDescriptor;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -35,20 +32,10 @@
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class FindBinaryFromDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class FindBinaryFromDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new FindBinaryFromDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = FindBinaryFromDescriptor::new;
 
     @Override
     public FunctionIdentifier getIdentifier() {
@@ -60,15 +47,13 @@
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractFindBinaryEvaluator(ctx, args, baseOffset, getIdentifier(), sourceLoc) {
+                return new AbstractFindBinaryEvaluator(ctx, args, getIdentifier(), sourceLoc) {
                     @Override
                     protected int getFromOffset(IFrameTupleReference tuple) throws HyracksDataException {
                         return ATypeHierarchy.getIntegerValue(getIdentifier().getName(), 2,
-                                pointables[2].getByteArray(), pointables[2].getStartOffset()) - baseOffset;
+                                pointables[2].getByteArray(), pointables[2].getStartOffset());
                     }
                 };
             }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
index fa6ff88..16a181d 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
@@ -21,11 +21,8 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
-import org.apache.asterix.runtime.evaluators.functions.AbstractStringOffsetConfigurableDescriptor;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -34,19 +31,9 @@
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class SubBinaryFromDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class SubBinaryFromDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubBinaryFromDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = SubBinaryFromDescriptor::new;
 
     @Override
     public FunctionIdentifier getIdentifier() {
@@ -58,11 +45,9 @@
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractSubBinaryEvaluator(ctx, args, baseOffset, getIdentifier(), sourceLoc) {
+                return new AbstractSubBinaryEvaluator(ctx, args, getIdentifier(), sourceLoc) {
                     @Override
                     protected int getSubLength(IFrameTupleReference tuple) {
                         return Integer.MAX_VALUE;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
index 8926e21..6a1c688 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
@@ -21,12 +21,9 @@
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.functions.IFunctionTypeInferer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
-import org.apache.asterix.runtime.evaluators.functions.AbstractStringOffsetConfigurableDescriptor;
-import org.apache.asterix.runtime.functions.FunctionTypeInferers;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -35,19 +32,9 @@
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
-public class SubBinaryFromToDescriptor extends AbstractStringOffsetConfigurableDescriptor {
+public class SubBinaryFromToDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new SubBinaryFromToDescriptor();
-        }
-
-        @Override
-        public IFunctionTypeInferer createFunctionTypeInferer() {
-            return FunctionTypeInferers.SET_STRING_OFFSET;
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = SubBinaryFromToDescriptor::new;
 
     @Override
     public FunctionIdentifier getIdentifier() {
@@ -59,12 +46,10 @@
         return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            private final int baseOffset = stringOffset;
-
             @Override
             public IScalarEvaluator createScalarEvaluator(final IEvaluatorContext ctx) throws HyracksDataException {
 
-                return new AbstractSubBinaryEvaluator(ctx, args, baseOffset, getIdentifier(), sourceLoc) {
+                return new AbstractSubBinaryEvaluator(ctx, args, getIdentifier(), sourceLoc) {
                     @Override
                     protected int getSubLength(IFrameTupleReference tuple) throws HyracksDataException {
                         return ATypeHierarchy.getIntegerValue(getIdentifier().getName(), 2,
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
index 9e9b76e..0d8557f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
@@ -408,6 +408,7 @@
 import org.apache.asterix.runtime.evaluators.functions.StringLikeDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringLowerCaseDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringPositionDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringPositionOffset1Descriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRTrim2Descriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRTrimDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpContainsDescriptor;
@@ -415,6 +416,8 @@
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpLikeDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpLikeWithFlagDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpPositionDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringRegExpPositionOffset1Descriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringRegExpPositionOffset1WithFlagDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpPositionWithFlagDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpReplaceDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringRegExpReplaceWithFlagDescriptor;
@@ -429,9 +432,11 @@
 import org.apache.asterix.runtime.evaluators.functions.StringTrimDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringUpperCaseDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.Substring2Descriptor;
+import org.apache.asterix.runtime.evaluators.functions.Substring2Offset1Descriptor;
 import org.apache.asterix.runtime.evaluators.functions.SubstringAfterDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.SubstringBeforeDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.SubstringDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SubstringOffset1Descriptor;
 import org.apache.asterix.runtime.evaluators.functions.SwitchCaseDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.ToArrayDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.ToAtomicDescriptor;
@@ -968,11 +973,13 @@
         fc.add(StringEndsWithDescriptor.FACTORY);
         fc.add(StringStartsWithDescriptor.FACTORY);
         fc.add(SubstringDescriptor.FACTORY);
+        fc.add(SubstringOffset1Descriptor.FACTORY);
         fc.add(StringEqualDescriptor.FACTORY);
         fc.add(StringLowerCaseDescriptor.FACTORY);
         fc.add(StringUpperCaseDescriptor.FACTORY);
         fc.add(StringLengthDescriptor.FACTORY);
         fc.add(Substring2Descriptor.FACTORY);
+        fc.add(Substring2Offset1Descriptor.FACTORY);
         fc.add(SubstringBeforeDescriptor.FACTORY);
         fc.add(SubstringAfterDescriptor.FACTORY);
         fc.add(StringToCodePointDescriptor.FACTORY);
@@ -984,7 +991,9 @@
         fc.add(StringRegExpLikeDescriptor.FACTORY);
         fc.add(StringRegExpLikeWithFlagDescriptor.FACTORY);
         fc.add(StringRegExpPositionDescriptor.FACTORY);
+        fc.add(StringRegExpPositionOffset1Descriptor.FACTORY);
         fc.add(StringRegExpPositionWithFlagDescriptor.FACTORY);
+        fc.add(StringRegExpPositionOffset1WithFlagDescriptor.FACTORY);
         fc.add(StringRegExpReplaceDescriptor.FACTORY);
         fc.add(StringRegExpReplaceWithFlagDescriptor.FACTORY);
         fc.add(StringInitCapDescriptor.FACTORY);
@@ -995,6 +1004,7 @@
         fc.add(StringLTrim2Descriptor.FACTORY);
         fc.add(StringRTrim2Descriptor.FACTORY);
         fc.add(StringPositionDescriptor.FACTORY);
+        fc.add(StringPositionOffset1Descriptor.FACTORY);
         fc.add(StringRepeatDescriptor.FACTORY);
         fc.add(StringReplaceDescriptor.FACTORY);
         fc.add(StringReplaceWithLimitDescriptor.FACTORY);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
index 5dc56dd..414f0eb 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionTypeInferers.java
@@ -61,14 +61,6 @@
         }
     };
 
-    public static final IFunctionTypeInferer SET_STRING_OFFSET = new IFunctionTypeInferer() {
-        @Override
-        public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context,
-                CompilerProperties compilerProps) {
-            fd.setImmutableStates(compilerProps.getStringOffset());
-        }
-    };
-
     public static final IFunctionTypeInferer SET_ARGUMENT_TYPE = new IFunctionTypeInferer() {
         @Override
         public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context,
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionExchangePOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionExchangePOperator.java
index bb0081a..fe96d4f 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionExchangePOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionExchangePOperator.java
@@ -45,10 +45,11 @@
 import org.apache.hyracks.api.dataflow.IConnectorDescriptor;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.job.IConnectorDescriptorRegistry;
-import org.apache.hyracks.dataflow.common.data.partition.range.DynamicFieldRangePartitionComputerFactory;
+import org.apache.hyracks.dataflow.common.data.partition.range.DynamicRangeMapSupplier;
 import org.apache.hyracks.dataflow.common.data.partition.range.FieldRangePartitionComputerFactory;
 import org.apache.hyracks.dataflow.common.data.partition.range.RangeMap;
-import org.apache.hyracks.dataflow.common.data.partition.range.StaticFieldRangePartitionComputerFactory;
+import org.apache.hyracks.dataflow.common.data.partition.range.RangeMapSupplier;
+import org.apache.hyracks.dataflow.common.data.partition.range.StaticRangeMapSupplier;
 import org.apache.hyracks.dataflow.std.connectors.MToNPartitioningConnectorDescriptor;
 
 public class RangePartitionExchangePOperator extends AbstractExchangePOperator {
@@ -119,14 +120,10 @@
             comps[i] = bcfp.getBinaryComparatorFactory(type, oc.getOrder() == OrderKind.ASC);
             i++;
         }
-        FieldRangePartitionComputerFactory partitionerFactory;
-        if (rangeMapIsComputedAtRunTime) {
-            partitionerFactory = new DynamicFieldRangePartitionComputerFactory(sortFields, comps, rangeMapKeyInContext,
-                    op.getSourceLocation());
-        } else {
-            partitionerFactory = new StaticFieldRangePartitionComputerFactory(sortFields, comps, rangeMap);
-        }
-
+        RangeMapSupplier rangeMapSupplier = rangeMapIsComputedAtRunTime
+                ? new DynamicRangeMapSupplier(rangeMapKeyInContext) : new StaticRangeMapSupplier(rangeMap);
+        FieldRangePartitionComputerFactory partitionerFactory =
+                new FieldRangePartitionComputerFactory(sortFields, comps, rangeMapSupplier, op.getSourceLocation());
         IConnectorDescriptor conn = new MToNPartitioningConnectorDescriptor(spec, partitionerFactory);
         return new Pair<>(conn, null);
     }
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionMergeExchangePOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionMergeExchangePOperator.java
index 15a2d8f..ba4a6b7 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionMergeExchangePOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RangePartitionMergeExchangePOperator.java
@@ -52,8 +52,9 @@
 import org.apache.hyracks.api.dataflow.value.INormalizedKeyComputerFactory;
 import org.apache.hyracks.api.dataflow.value.ITuplePartitionComputerFactory;
 import org.apache.hyracks.api.job.IConnectorDescriptorRegistry;
+import org.apache.hyracks.dataflow.common.data.partition.range.FieldRangePartitionComputerFactory;
 import org.apache.hyracks.dataflow.common.data.partition.range.RangeMap;
-import org.apache.hyracks.dataflow.common.data.partition.range.StaticFieldRangePartitionComputerFactory;
+import org.apache.hyracks.dataflow.common.data.partition.range.StaticRangeMapSupplier;
 import org.apache.hyracks.dataflow.std.connectors.MToNPartitioningMergingConnectorDescriptor;
 
 public class RangePartitionMergeExchangePOperator extends AbstractExchangePOperator {
@@ -138,7 +139,8 @@
             comps[i] = bcfp.getBinaryComparatorFactory(type, oc.getOrder() == OrderKind.ASC);
             i++;
         }
-        ITuplePartitionComputerFactory tpcf = new StaticFieldRangePartitionComputerFactory(sortFields, comps, rangeMap);
+        ITuplePartitionComputerFactory tpcf = new FieldRangePartitionComputerFactory(sortFields, comps,
+                new StaticRangeMapSupplier(rangeMap), op.getSourceLocation());
         IConnectorDescriptor conn = new MToNPartitioningMergingConnectorDescriptor(spec, tpcf, sortFields, comps, nkcf);
         return new Pair<IConnectorDescriptor, TargetConstraint>(conn, null);
     }
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputer.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputer.java
new file mode 100644
index 0000000..13c5ed8
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputer.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hyracks.api.dataflow.value;
+
+import java.util.BitSet;
+
+import org.apache.hyracks.api.comm.IFrameTupleAccessor;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public interface ITupleMultiPartitionComputer {
+    /**
+     * For the tuple (located at tIndex in the frame), it determines which target partitions (0,1,... nParts-1) the
+     * tuple should be sent/written to.
+     * @param accessor The accessor of the frame to access tuples
+     * @param tIndex The index of the tuple in consideration
+     * @param nParts The number of target partitions
+     * @return The chosen target partitions as dictated by the logic of the partition computer
+     * @throws HyracksDataException
+     */
+    BitSet partition(IFrameTupleAccessor accessor, int tIndex, int nParts) throws HyracksDataException;
+
+    /**
+     * Gives the data partitioner a chance to set up its environment before it starts partitioning tuples. This method
+     * should be called in the open() of {@link org.apache.hyracks.api.comm.IFrameWriter}. The default implementation
+     * is "do nothing".
+     * @throws HyracksDataException
+     */
+    default void initialize() throws HyracksDataException {
+    }
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputerFactory.java
similarity index 71%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
copy to hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputerFactory.java
index 6568d06..c8821c3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position_with_flag/regexp_position_with_flag.3.query.sqlpp
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/value/ITupleMultiPartitionComputerFactory.java
@@ -17,4 +17,12 @@
  * under the License.
  */
 
-{'result1': REGEXP_POSITION('helloworld','hello world','x')};
+package org.apache.hyracks.api.dataflow.value;
+
+import java.io.Serializable;
+
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public interface ITupleMultiPartitionComputerFactory extends Serializable {
+    ITupleMultiPartitionComputer createPartitioner(IHyracksTaskContext hyracksTaskContext);
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicFieldRangePartitionComputerFactory.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicFieldRangePartitionComputerFactory.java
deleted file mode 100644
index bc642a9..0000000
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicFieldRangePartitionComputerFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.dataflow.common.data.partition.range;
-
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-import org.apache.hyracks.api.exceptions.ErrorCode;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.api.exceptions.SourceLocation;
-import org.apache.hyracks.dataflow.common.utils.TaskUtil;
-
-public class DynamicFieldRangePartitionComputerFactory extends FieldRangePartitionComputerFactory {
-    private static final long serialVersionUID = 1L;
-    private final String rangeMapKeyInContext;
-    private final SourceLocation sourceLocation;
-
-    public DynamicFieldRangePartitionComputerFactory(int[] rangeFields, IBinaryComparatorFactory[] comparatorFactories,
-            String rangeMapKeyInContext, SourceLocation sourceLocation) {
-        super(rangeFields, comparatorFactories);
-        this.rangeMapKeyInContext = rangeMapKeyInContext;
-        this.sourceLocation = sourceLocation;
-    }
-
-    @Override
-    protected RangeMap getRangeMap(IHyracksTaskContext hyracksTaskContext) throws HyracksDataException {
-        RangeMap rangeMap = TaskUtil.get(rangeMapKeyInContext, hyracksTaskContext);
-        if (rangeMap == null) {
-            throw HyracksDataException.create(ErrorCode.RANGEMAP_NOT_FOUND, sourceLocation);
-        }
-        return rangeMap;
-    }
-}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicRangeMapSupplier.java
similarity index 64%
copy from hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java
copy to hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicRangeMapSupplier.java
index b17c550..cfc4b82 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/DynamicRangeMapSupplier.java
@@ -16,23 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.hyracks.dataflow.common.data.partition.range;
 
 import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import org.apache.hyracks.dataflow.common.utils.TaskUtil;
 
-public class StaticFieldRangePartitionComputerFactory extends FieldRangePartitionComputerFactory {
+public final class DynamicRangeMapSupplier implements RangeMapSupplier {
+
     private static final long serialVersionUID = 1L;
-    private RangeMap rangeMap;
 
-    public StaticFieldRangePartitionComputerFactory(int[] rangeFields, IBinaryComparatorFactory[] comparatorFactories,
-            RangeMap rangeMap) {
-        super(rangeFields, comparatorFactories);
-        this.rangeMap = rangeMap;
+    private final String rangeMapKeyInContext;
+
+    public DynamicRangeMapSupplier(String rangeMapKeyInContext) {
+        this.rangeMapKeyInContext = rangeMapKeyInContext;
     }
 
-    @Override
-    protected RangeMap getRangeMap(IHyracksTaskContext hyracksTaskContext) {
-        return rangeMap;
+    public RangeMap getRangeMap(IHyracksTaskContext taskContext) {
+        return TaskUtil.get(rangeMapKeyInContext, taskContext);
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/FieldRangePartitionComputerFactory.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/FieldRangePartitionComputerFactory.java
index 55d4420..1831a5f 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/FieldRangePartitionComputerFactory.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/FieldRangePartitionComputerFactory.java
@@ -24,22 +24,27 @@
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.dataflow.value.ITuplePartitionComputer;
 import org.apache.hyracks.api.dataflow.value.ITuplePartitionComputerFactory;
+import org.apache.hyracks.api.exceptions.ErrorCode;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 
-public abstract class FieldRangePartitionComputerFactory implements ITuplePartitionComputerFactory {
+public final class FieldRangePartitionComputerFactory implements ITuplePartitionComputerFactory {
     private static final long serialVersionUID = 1L;
     private final int[] rangeFields;
-    private IBinaryComparatorFactory[] comparatorFactories;
+    private final IBinaryComparatorFactory[] comparatorFactories;
+    private final RangeMapSupplier rangeMapSupplier;
+    private final SourceLocation sourceLocation;
 
-    protected FieldRangePartitionComputerFactory(int[] rangeFields, IBinaryComparatorFactory[] comparatorFactories) {
+    public FieldRangePartitionComputerFactory(int[] rangeFields, IBinaryComparatorFactory[] comparatorFactories,
+            RangeMapSupplier rangeMapSupplier, SourceLocation sourceLocation) {
         this.rangeFields = rangeFields;
+        this.rangeMapSupplier = rangeMapSupplier;
         this.comparatorFactories = comparatorFactories;
+        this.sourceLocation = sourceLocation;
     }
 
-    protected abstract RangeMap getRangeMap(IHyracksTaskContext hyracksTaskContext) throws HyracksDataException;
-
     @Override
-    public ITuplePartitionComputer createPartitioner(IHyracksTaskContext hyracksTaskContext) {
+    public ITuplePartitionComputer createPartitioner(IHyracksTaskContext taskContext) {
         final IBinaryComparator[] comparators = new IBinaryComparator[comparatorFactories.length];
         for (int i = 0; i < comparatorFactories.length; ++i) {
             comparators[i] = comparatorFactories[i].createBinaryComparator();
@@ -50,7 +55,10 @@
 
             @Override
             public void initialize() throws HyracksDataException {
-                rangeMap = getRangeMap(hyracksTaskContext);
+                rangeMap = rangeMapSupplier.getRangeMap(taskContext);
+                if (rangeMap == null) {
+                    throw HyracksDataException.create(ErrorCode.RANGEMAP_NOT_FOUND, sourceLocation);
+                }
             }
 
             @Override
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/RangeMapSupplier.java
similarity index 74%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
copy to hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/RangeMapSupplier.java
index 7bd4fad..fc0911e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/string/regexp_position/regexp_position.4.query.sqlpp
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/RangeMapSupplier.java
@@ -17,6 +17,12 @@
  * under the License.
  */
 
-USE test;
+package org.apache.hyracks.dataflow.common.data.partition.range;
 
-FROM ds SELECT VALUE regexp_position(test_str, pattern) ORDER BY id;
\ No newline at end of file
+import java.io.Serializable;
+
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+
+public interface RangeMapSupplier extends Serializable {
+    RangeMap getRangeMap(IHyracksTaskContext taskContext);
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticRangeMapSupplier.java
similarity index 69%
rename from hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java
rename to hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticRangeMapSupplier.java
index b17c550..613ccc5 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticFieldRangePartitionComputerFactory.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/data/partition/range/StaticRangeMapSupplier.java
@@ -16,23 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.hyracks.dataflow.common.data.partition.range;
 
 import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 
-public class StaticFieldRangePartitionComputerFactory extends FieldRangePartitionComputerFactory {
+public final class StaticRangeMapSupplier implements RangeMapSupplier {
+
     private static final long serialVersionUID = 1L;
-    private RangeMap rangeMap;
 
-    public StaticFieldRangePartitionComputerFactory(int[] rangeFields, IBinaryComparatorFactory[] comparatorFactories,
-            RangeMap rangeMap) {
-        super(rangeFields, comparatorFactories);
+    private final RangeMap rangeMap;
+
+    public StaticRangeMapSupplier(RangeMap rangeMap) {
         this.rangeMap = rangeMap;
     }
 
     @Override
-    protected RangeMap getRangeMap(IHyracksTaskContext hyracksTaskContext) {
+    public RangeMap getRangeMap(IHyracksTaskContext taskContext) {
         return rangeMap;
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/IPartitionedTupleBufferManager.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/IPartitionedTupleBufferManager.java
index 6c08be2..b1605f3 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/IPartitionedTupleBufferManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/IPartitionedTupleBufferManager.java
@@ -80,6 +80,13 @@
     void cancelInsertTuple(int partition) throws HyracksDataException;
 
     /**
+     * Sets the constrain.
+     * @param constrain
+     *              the constrain to be set.
+     */
+    void setConstrain(IPartitionedMemoryConstrain constrain);
+
+    /**
      * Reset to the initial states. The previous allocated resources won't be released in order to be used in the next round.
      *
      * @throws HyracksDataException
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
index 731e7ed..dfa2b45 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/buffermanager/VPartitionTupleBufferManager.java
@@ -51,7 +51,7 @@
     private final FixedSizeFrame appendFrame;
     private final FixedSizeFrameTupleAppender appender;
     private BufferInfo tempInfo;
-    private final IPartitionedMemoryConstrain constrain;
+    private IPartitionedMemoryConstrain constrain;
 
     // In case where a frame pool is shared by one or more buffer manager(s), it can be provided from the caller.
     public VPartitionTupleBufferManager(IPartitionedMemoryConstrain constrain, int partitions,
@@ -77,6 +77,11 @@
     }
 
     @Override
+    public void setConstrain(IPartitionedMemoryConstrain constrain) {
+        this.constrain = constrain;
+    }
+
+    @Override
     public void reset() throws HyracksDataException {
         for (IFrameBufferManager part : partitionArray) {
             if (part != null) {
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/AbstractPartitionDataWriter.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/AbstractPartitionDataWriter.java
new file mode 100644
index 0000000..03f260a
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/AbstractPartitionDataWriter.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hyracks.dataflow.std.connectors;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.apache.hyracks.api.comm.IFrameWriter;
+import org.apache.hyracks.api.comm.IPartitionWriterFactory;
+import org.apache.hyracks.api.comm.VSizeFrame;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
+import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
+import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
+import org.apache.hyracks.util.trace.ITracer;
+
+abstract class AbstractPartitionDataWriter implements IFrameWriter {
+
+    protected final int consumerPartitionCount;
+    private final IFrameWriter[] pWriters;
+    private final boolean[] isOpen;
+    private final FrameTupleAppender[] appenders;
+    protected final FrameTupleAccessor tupleAccessor;
+    protected final IHyracksTaskContext ctx;
+    private boolean[] allocatedFrames;
+    private boolean failed = false;
+
+    public AbstractPartitionDataWriter(IHyracksTaskContext ctx, int consumerPartitionCount,
+            IPartitionWriterFactory pwFactory, RecordDescriptor recordDescriptor) throws HyracksDataException {
+        this.ctx = ctx;
+        this.consumerPartitionCount = consumerPartitionCount;
+        pWriters = new IFrameWriter[consumerPartitionCount];
+        isOpen = new boolean[consumerPartitionCount];
+        allocatedFrames = new boolean[consumerPartitionCount];
+        appenders = new FrameTupleAppender[consumerPartitionCount];
+        tupleAccessor = new FrameTupleAccessor(recordDescriptor);
+        initializeAppenders(pwFactory);
+    }
+
+    protected void initializeAppenders(IPartitionWriterFactory pwFactory) throws HyracksDataException {
+        for (int i = 0; i < consumerPartitionCount; ++i) {
+            try {
+                pWriters[i] = pwFactory.createFrameWriter(i);
+                appenders[i] = createTupleAppender(ctx);
+            } catch (IOException e) {
+                throw HyracksDataException.create(e);
+            }
+        }
+    }
+
+    protected FrameTupleAppender createTupleAppender(IHyracksTaskContext ctx) {
+        return new FrameTupleAppender();
+    }
+
+    @Override
+    public void close() throws HyracksDataException {
+        HyracksDataException closeException = null;
+        if (!failed) {
+            boolean newFailure = false;
+            for (int i = 0; i < pWriters.length; ++i) {
+                try {
+                    if (isOpen[i] && allocatedFrames[i] && appenders[i].getTupleCount() > 0) {
+                        appenders[i].write(pWriters[i], true);
+                    }
+                } catch (Exception e) {
+                    newFailure = true;
+                    closeException = wrapException(closeException, e);
+                    break;
+                }
+            }
+            if (newFailure) {
+                try {
+                    fail(); // Fail all writers if any new failure happens.
+                } catch (Exception e) {
+                    closeException = wrapException(closeException, e);
+                }
+            }
+        }
+        for (int i = 0; i < pWriters.length; ++i) {
+            if (isOpen[i]) {
+                // The try-block make sures that every writer is closed.
+                try {
+                    pWriters[i].close();
+                } catch (Exception e) {
+                    closeException = wrapException(closeException, e);
+                }
+            }
+        }
+        if (closeException != null) {
+            throw closeException;
+        }
+    }
+
+    @Override
+    public void open() throws HyracksDataException {
+        for (int i = 0; i < pWriters.length; ++i) {
+            isOpen[i] = true;
+            pWriters[i].open();
+        }
+    }
+
+    @Override
+    public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
+        tupleAccessor.reset(buffer);
+        int tupleCount = tupleAccessor.getTupleCount();
+        for (int i = 0; i < tupleCount; ++i) {
+            processTuple(i);
+        }
+    }
+
+    protected abstract void processTuple(int tupleIndex) throws HyracksDataException;
+
+    protected void appendToPartitionWriter(int tupleIndex, int partition) throws HyracksDataException {
+        if (!allocatedFrames[partition]) {
+            allocateFrames(partition);
+        }
+        FrameUtils.appendToWriter(pWriters[partition], appenders[partition], tupleAccessor, tupleIndex);
+    }
+
+    protected void allocateFrames(int i) throws HyracksDataException {
+        appenders[i].reset(new VSizeFrame(ctx), true);
+        allocatedFrames[i] = true;
+    }
+
+    @Override
+    public void fail() throws HyracksDataException {
+        failed = true;
+        HyracksDataException failException = null;
+        for (int i = 0; i < appenders.length; ++i) {
+            if (isOpen[i]) {
+                try {
+                    pWriters[i].fail();
+                } catch (Exception e) {
+                    failException = wrapException(failException, e);
+                }
+            }
+        }
+        if (failException != null) {
+            throw failException;
+        }
+    }
+
+    @Override
+    public void flush() throws HyracksDataException {
+        for (int i = 0; i < consumerPartitionCount; i++) {
+            if (allocatedFrames[i]) {
+                appenders[i].flush(pWriters[i]);
+            }
+        }
+    }
+
+    public void flush(ITracer tracer, String name, long cat, String args) throws HyracksDataException {
+        for (int i = 0; i < consumerPartitionCount; i++) {
+            if (allocatedFrames[i]) {
+                appenders[i].flush(pWriters[i], tracer, name, cat, args);
+            }
+        }
+    }
+
+    // Wraps the current encountered exception into the final exception.
+    private HyracksDataException wrapException(HyracksDataException finalException, Exception currentException) {
+        if (finalException == null) {
+            return HyracksDataException.create(currentException);
+        }
+        finalException.addSuppressed(currentException);
+        return finalException;
+    }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MToNPartialBroadcastConnectorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MToNPartialBroadcastConnectorDescriptor.java
new file mode 100644
index 0000000..5d79f8c
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MToNPartialBroadcastConnectorDescriptor.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hyracks.dataflow.std.connectors;
+
+import org.apache.hyracks.api.comm.IFrameWriter;
+import org.apache.hyracks.api.comm.IPartitionWriterFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.dataflow.value.ITupleMultiPartitionComputerFactory;
+import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.job.IConnectorDescriptorRegistry;
+import org.apache.hyracks.dataflow.std.base.AbstractMToNConnectorDescriptor;
+
+public class MToNPartialBroadcastConnectorDescriptor extends AbstractMToNConnectorDescriptor {
+
+    private static final long serialVersionUID = 1L;
+
+    protected ITupleMultiPartitionComputerFactory tpcf;
+
+    public MToNPartialBroadcastConnectorDescriptor(IConnectorDescriptorRegistry spec,
+            ITupleMultiPartitionComputerFactory tpcf) {
+        super(spec);
+        this.tpcf = tpcf;
+    }
+
+    @Override
+    public IFrameWriter createPartitioner(IHyracksTaskContext ctx, RecordDescriptor recordDesc,
+            IPartitionWriterFactory edwFactory, int index, int nProducerPartitions, int nConsumerPartitions)
+            throws HyracksDataException {
+        return new MultiPartitionDataWriter(ctx, nConsumerPartitions, edwFactory, recordDesc,
+                tpcf.createPartitioner(ctx));
+    }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MultiPartitionDataWriter.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MultiPartitionDataWriter.java
new file mode 100644
index 0000000..aed39df
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/MultiPartitionDataWriter.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hyracks.dataflow.std.connectors;
+
+import java.util.BitSet;
+
+import org.apache.hyracks.api.comm.IPartitionWriterFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.dataflow.value.ITupleMultiPartitionComputer;
+import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class MultiPartitionDataWriter extends AbstractPartitionDataWriter {
+
+    private final ITupleMultiPartitionComputer tpc;
+
+    public MultiPartitionDataWriter(IHyracksTaskContext ctx, int consumerPartitionCount,
+            IPartitionWriterFactory pwFactory, RecordDescriptor recordDescriptor, ITupleMultiPartitionComputer tpc)
+            throws HyracksDataException {
+        super(ctx, consumerPartitionCount, pwFactory, recordDescriptor);
+        this.tpc = tpc;
+    }
+
+    @Override
+    public void open() throws HyracksDataException {
+        super.open();
+        tpc.initialize();
+    }
+
+    @Override
+    protected void processTuple(int tupleIndex) throws HyracksDataException {
+        BitSet partitionSet = tpc.partition(tupleAccessor, tupleIndex, consumerPartitionCount);
+        for (int p = partitionSet.nextSetBit(0); p >= 0; p = partitionSet.nextSetBit(p + 1)) {
+            appendToPartitionWriter(tupleIndex, p);
+        }
+    }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/PartitionDataWriter.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/PartitionDataWriter.java
index d06d5d3..e67f9a8 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/PartitionDataWriter.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/connectors/PartitionDataWriter.java
@@ -18,167 +18,31 @@
  */
 package org.apache.hyracks.dataflow.std.connectors;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.hyracks.api.comm.IFrameWriter;
 import org.apache.hyracks.api.comm.IPartitionWriterFactory;
-import org.apache.hyracks.api.comm.VSizeFrame;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ITuplePartitionComputer;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
-import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
-import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
-import org.apache.hyracks.util.trace.ITracer;
 
-public class PartitionDataWriter implements IFrameWriter {
-    private final int consumerPartitionCount;
-    private final IFrameWriter[] pWriters;
-    private final boolean[] isOpen;
-    private final FrameTupleAppender[] appenders;
-    private final FrameTupleAccessor tupleAccessor;
+public class PartitionDataWriter extends AbstractPartitionDataWriter {
+
     private final ITuplePartitionComputer tpc;
-    private final IHyracksTaskContext ctx;
-    private boolean[] allocatedFrames;
-    private boolean failed = false;
 
     public PartitionDataWriter(IHyracksTaskContext ctx, int consumerPartitionCount, IPartitionWriterFactory pwFactory,
             RecordDescriptor recordDescriptor, ITuplePartitionComputer tpc) throws HyracksDataException {
-        this.ctx = ctx;
+        super(ctx, consumerPartitionCount, pwFactory, recordDescriptor);
         this.tpc = tpc;
-        this.consumerPartitionCount = consumerPartitionCount;
-        pWriters = new IFrameWriter[consumerPartitionCount];
-        isOpen = new boolean[consumerPartitionCount];
-        allocatedFrames = new boolean[consumerPartitionCount];
-        appenders = new FrameTupleAppender[consumerPartitionCount];
-        tupleAccessor = new FrameTupleAccessor(recordDescriptor);
-        initializeAppenders(pwFactory);
-    }
-
-    protected void initializeAppenders(IPartitionWriterFactory pwFactory) throws HyracksDataException {
-        for (int i = 0; i < consumerPartitionCount; ++i) {
-            try {
-                pWriters[i] = pwFactory.createFrameWriter(i);
-                appenders[i] = createTupleAppender(ctx);
-            } catch (IOException e) {
-                throw HyracksDataException.create(e);
-            }
-        }
-    }
-
-    protected FrameTupleAppender createTupleAppender(IHyracksTaskContext ctx) {
-        return new FrameTupleAppender();
-    }
-
-    @Override
-    public void close() throws HyracksDataException {
-        HyracksDataException closeException = null;
-        if (!failed) {
-            boolean newFailure = false;
-            for (int i = 0; i < pWriters.length; ++i) {
-                try {
-                    if (isOpen[i] && allocatedFrames[i] && appenders[i].getTupleCount() > 0) {
-                        appenders[i].write(pWriters[i], true);
-                    }
-                } catch (Exception e) {
-                    newFailure = true;
-                    closeException = wrapException(closeException, e);
-                    break;
-                }
-            }
-            if (newFailure) {
-                try {
-                    fail(); // Fail all writers if any new failure happens.
-                } catch (Exception e) {
-                    closeException = wrapException(closeException, e);
-                }
-            }
-        }
-        for (int i = 0; i < pWriters.length; ++i) {
-            if (isOpen[i]) {
-                // The try-block make sures that every writer is closed.
-                try {
-                    pWriters[i].close();
-                } catch (Exception e) {
-                    closeException = wrapException(closeException, e);
-                }
-            }
-        }
-        if (closeException != null) {
-            throw closeException;
-        }
     }
 
     @Override
     public void open() throws HyracksDataException {
+        super.open();
         tpc.initialize();
-        for (int i = 0; i < pWriters.length; ++i) {
-            isOpen[i] = true;
-            pWriters[i].open();
-        }
     }
 
     @Override
-    public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
-        tupleAccessor.reset(buffer);
-        int tupleCount = tupleAccessor.getTupleCount();
-        for (int i = 0; i < tupleCount; ++i) {
-            int h = tpc.partition(tupleAccessor, i, consumerPartitionCount);
-            if (!allocatedFrames[h]) {
-                allocateFrames(h);
-            }
-            FrameUtils.appendToWriter(pWriters[h], appenders[h], tupleAccessor, i);
-        }
-    }
-
-    protected void allocateFrames(int i) throws HyracksDataException {
-        appenders[i].reset(new VSizeFrame(ctx), true);
-        allocatedFrames[i] = true;
-    }
-
-    @Override
-    public void fail() throws HyracksDataException {
-        failed = true;
-        HyracksDataException failException = null;
-        for (int i = 0; i < appenders.length; ++i) {
-            if (isOpen[i]) {
-                try {
-                    pWriters[i].fail();
-                } catch (Exception e) {
-                    failException = wrapException(failException, e);
-                }
-            }
-        }
-        if (failException != null) {
-            throw failException;
-        }
-    }
-
-    @Override
-    public void flush() throws HyracksDataException {
-        for (int i = 0; i < consumerPartitionCount; i++) {
-            if (allocatedFrames[i]) {
-                appenders[i].flush(pWriters[i]);
-            }
-        }
-    }
-
-    public void flush(ITracer tracer, String name, long cat, String args) throws HyracksDataException {
-        for (int i = 0; i < consumerPartitionCount; i++) {
-            if (allocatedFrames[i]) {
-                appenders[i].flush(pWriters[i], tracer, name, cat, args);
-            }
-        }
-    }
-
-    // Wraps the current encountered exception into the final exception.
-    private HyracksDataException wrapException(HyracksDataException finalException, Exception currentException) {
-        if (finalException == null) {
-            return HyracksDataException.create(currentException);
-        }
-        finalException.addSuppressed(currentException);
-        return finalException;
+    protected void processTuple(int tupleIndex) throws HyracksDataException {
+        int p = tpc.partition(tupleAccessor, tupleIndex, consumerPartitionCount);
+        appendToPartitionWriter(tupleIndex, p);
     }
 }
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoin.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoin.java
index 7b6dcdb..6fb55ec 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoin.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoin.java
@@ -432,6 +432,7 @@
 
     public void initProbe() {
         probePSizeInTups = new int[numOfPartitions];
+        bufferManager.setConstrain(VPartitionTupleBufferManager.NO_CONSTRAIN);
     }
 
     public void probe(ByteBuffer buffer, IFrameWriter writer) throws HyracksDataException {