本文介绍了Oracle中所有重音字符的regexp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试查找带有重音字符的数据。我试过这个:

I am trying to find data that has accented characters. I've tried this:

select *
from xml_tmp
where regexp_like (XMLTYpe.getClobVal(xml_tmp.xml_data), unistr('\0090'))

它找到XML数据字段包含É的所有记录。问题是,它只匹配大写E与口音。我试图写一个更通用的查询来查找带有重音元音(a,e,i,o,u,大写和小写,任何重音符)使用等价类的所有数据。我想要一个正则表达式来匹配只有重音元音,但我不知道如何得到它,因为等价类如 [[= e =]]

And it works. It finds all records where the XML data field contains É. The problem is that it only matches the upper-case E with an accent. I tried to write a more generic query to find ALL data with accented vowels (a, e, i, o, u, upper and lowercase, with any accents) using equivalence classes. I wanted a regex to match only accented vowels, but I'm not sure how to get it, as equivalence classes such as [[=e=]] match all e's (with or without accents).

此外,这实际上不起作用:

Also, this does not actually work:

select *
from xml_tmp
where regexp_like (XMLTYpe.getClobVal(xml_data),'É');

(使用Oracle 10g)

(using Oracle 10g)

推荐答案

经过一些更多的实验,我发现这似乎工作确定:

After some more experimenting, I have found that this seems to work ok:

select *
from xml_tmp
where regexp_like(XMLTYpe.getClobVal(xml_data),'[^[:graph:][:space:]]') 

我曾经认为 [:graph:] 会包括全部

>进一步的实验表明,这可能不适用于所有情况。尝试以下查询:

Further experimentation shows that this might not work in all cases. Try these queries:

select *
from dual
where regexp_like (unistr('\0090'),'[^[:graph:][:space:]]');




DUMMY
-------
X
(the match succeeded)

所以看起来像是导致麻烦的字符匹配此模式。 / p>

So it looks like the character that's been causing me trouble matches this pattern.

select *
from dual
where regexp_like ('É','[^[:graph:][:space:]]');




DUMMY
-------

(the match failed)

当我尝试运行带有重音E的查询作为复制和粘贴,匹配失败!我想,无论我复制和粘贴实际上是不同的。呃,我想我现在讨厌改变字符编码。

When I try to run this query with the accented E as copied-and-pasted, the match fails! I guess whatever I copied-and-pasted is actually different. Ugh, I think I now hate working with changing character encodings.

这篇关于Oracle中所有重音字符的regexp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 08:11