字符函数 本页介绍天翼云TeleDB数据库Oracle语法中的字符函数。 regexpcount REGEXPCOUNT返回pattern在sourcechar串中出现的次数。 teledb select REGEXPCOUNT('teledbpgteledbpg','pg') from DUAL; regexpcount 2 (1 row) instr instr函数返回要截取的字符串在源字符串中的位置。 teledb select instr('helloworld','l') from dual; instr 3 (1 row) regexpsubstr string:需要进行正则处理的字符串。 pattern:进行匹配的正则表达式。 position:起始位置,从字符串的第几个字符开始正则表达式匹配(默认为1)。 注意 字符串最初的位置是1而不是0。 occurrence:获取第几个分割出来的组(分割后最初的字符串会按分割的顺序排列成组)。 modifier:模式(‘i’不区分大小写进行检索;‘c’区分大小写进行检索。默认为’c’)针对的是正则表达式里字符大小写的匹配。 teledb SELECT REGEXPSUBSTR('17,20,23','[^,]+',1,1,'i') AS STR FROM DUAL; str 17 (1 row) teledb regexpreplace regexpreplace(1,2,3,4,5,6) 语法说明: 1:字段 2:替换的字段 3:替换成什么 4:起始位置(默认从1开始) 5:替换的次数(0是无限次) 6:不区分大小写 teledb select regexpreplace('teledbteledb','x','ee',1,1) from dual; regexpreplace teledbeeteledb (1 row) teledb