【问题标题】:Split the camel cased sentence into words将驼峰式句子拆分成单词
【发布时间】:2015-02-15 21:09:34
【问题描述】:

我需要使用 SQL 将驼峰式句子拆分成单词。

示例: 'IHaveAPen' 变为 'I Have A Pen'

我正在使用regex

select regexp_replace('IAmGoodBoy','([^^])(A-Z)','\1 \2 \3') from dual;

按大写字母分割字符串。

但它不起作用。

这个可以吗?

【问题讨论】:

  • regexp_replace('IAmGoodBoy','([A-Z])',' \1') 可以。 Demo Here。它只是在每个大写字母后附加一个空格。
  • @MaheswaranRavisankar 您的解决方案以空格开头,因此它实际上是在前面加上空格。

标签: sql oracle sap regexp-replace


【解决方案1】:

尝试以下查询:

select regexp_replace('IAmGoodBoy','([A-Z][^A-Z]*)','\1 ') from dual;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 2011-08-14
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-10
    相关资源
    最近更新 更多