Postgresql 删除字符串中的希腊字母

Postgresql 删除字符串中的希腊字母,postgresql,regexp-replace,Postgresql,Regexp Replace,我正在预处理脏文本字段。我已经设法删除了单个字符和数字,但仍有希腊字母(来自公式)需要全部删除。 任何类型的希腊字母都可以出现在字符串中的任何位置。 有什么办法吗 select regexp_replace(' ω ω α ω alkanediylbis alkylimino bis alkanolpolyethoxylate the formula where straight branched chain alkylene group also known alk

我正在预处理脏文本字段。我已经设法删除了单个字符和数字,但仍有希腊字母(来自公式)需要全部删除。 任何类型的希腊字母都可以出现在字符串中的任何位置。 有什么办法吗

select regexp_replace(' ω ω α ω alkanediylbis alkylimino bis alkanolpolyethoxylate   the formula where       straight   branched chain alkylene group also known     alkanediyl group that has   the range       carbon atoms and     least  carbon atoms   length   and   can   the same   different and are primary alkyl groups which contain     carbon atoms each   and   can   the same   different and are alkylene groups which contain   the range   from     carbon atoms each and   and   are the same   different numerals     the range       each ', '\W+', '')

[Α-Ωα-ω]
将匹配标准希腊字母。(请注意,此处的
Α
与拉丁语
a
不同,尽管它们看起来可能相同)

一些常用的符号在标准字母表之外,因此至少,您可能希望使用
[\u0370-\u03FF]
匹配整个符号

Unicode也有

  • 包含带变音符号的字母的单词
  • 这张照片上有一些非常相似的人物
  • 具有自己的
    /
    /
    符号
  • 希腊字母表的几份副本
…可能更多

与其尝试列出要替换的所有内容,不如列出要保留的内容。例如,要删除可打印范围之外的所有内容:


是否只需要删除单个希腊字符或任何希腊字符?任何。它们也可以作为ωαω出现。。。
select regexp_replace(
  'ABCΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩω123',
  '[^\u0020-\u007E]', '', 'g'
);

 regexp_replace
----------------
 ABC123