-3
选择使用正则表达式一个字符的第一个发生前的字符串我有串像下面如何在Oracle
ThisSentence.should.split.beforeFirstPeriod.ofTheSentence
我想选择ThisSentence
。
我该怎么做与regexp_substr()
?
选择使用正则表达式一个字符的第一个发生前的字符串我有串像下面如何在Oracle
ThisSentence.should.split.beforeFirstPeriod.ofTheSentence
我想选择ThisSentence
。
我该怎么做与regexp_substr()
?
简单SUBSTR()
和INSTR()
可以做同样的工作:
SUBSTR(YourString, 0, INSTR(YourString, '.')-1)
鹭的答案是正确的。但是,Oracle还提供regexp_substr()
,它提供了更多的通用功能:
select regexp_substr(str, '[^.]+', 1, 1)
你究竟想要提取什么?逗号前的第一个字符串? – massko