This question already has an answer here:
这个问题在这里已有答案:
- Split string by space and character as delimiter in Oracle with regexp_substr 5 answers
使用空格和字符将字符串拆分为Oracle中的分隔符,使用regexp_substr 5个答案
I'm trying to split a string that's delimited by "space-quote-space" ( ' ) between the values.
我试图在值之间拆分由“space-quote-space”(')分隔的字符串。
The regex is run in an Oracle PL/SQL select statement, but I believe it's pretty good with the regex it allows
正则表达式是在Oracle PL / SQL select语句中运行的,但我相信它允许的正则表达式相当不错
The strings look like this:
字符串看起来像这样:
FINA 233ff ' BLA 33333333 ' FRED ' O'GLADSON ' 99 LEFT RD ' FLINDERS MI ' 9999 ' 0499999999 ' HERE ARE SOME NOTES $9999.00 OLD THING SD2232DD (LEFT) PLS SEE JOHN
While I can split the string based on the single quote easy enough -
虽然我可以很容易地根据单引号拆分字符串 -
[^']+
...it hits the quote in the middle of the surname (O'GLADSON). To make it easier I can add in a single quote on the start or the end. I can also trim the results afterward, if I can get the split right. What's the correct regex?
......它命中了姓氏中间的引用(O'GLADSON)。为了更容易,我可以在开头或结尾添加单引号。如果我可以得到正确的分割,我也可以在之后修剪结果。什么是正确的正则表达式?
1 个解决方案
#1
0
I think this is what you need :
我想这就是你需要的:
([:space:]''[:space:]) //single quote need to be escaped
#1
0
I think this is what you need :
我想这就是你需要的:
([:space:]''[:space:]) //single quote need to be escaped