所有字母表的正则表达式 [英] Regex for all alphabets
问题描述
我需要所有字母的正则表达式。我有一个输入和目标文本。它们都可以属于不同的字母表。我的意思是他们可以属于中文,拉丁文,西里尔文和其他任何字母。
i need a regex for all alphabets. I have an input and target text. Both of them can be belong different alphabets. I mean they can be belong chinese, latin, cyrillic and any others alphabet.
我需要一个用于多语言输入和多语言目标文本的正则表达式。
I need a regex for multi language input and multi language target text.
有没有人对此有任何想法?我怎么写这个正则表达式?
Is there anybody has any idea about this? How can i write this regex ?
我会用javascript来使用它。但我认为应该有针对java和javascript的常见正则表达式也适用于这个问题。
I will use this with javascript. But i think there should be common regex for java and javascript also for this problem.
推荐答案
我使用|这个角色作为分隔符,所以它对我来说是特殊的。键可以是除|之外的任何字符。它解决了我的问题,谢谢你的答案。它可以与javascript,java和groovy一起使用。我测试了它,工作了。
i use "|" this character as a separator, so it is speacial for me. Key can be any character except of "|". it solve my problems thanks for answers. And it can be used with javascript, java and groovy. I tested it, worked.
var keyPrefix ="\\|[\u0000-\u007B\u007D-\uFFEF]*";
var keySuffix = "[\u0000-\u007B\u007D-\uFFEF]*\\|";
var searchkey = keyPrefix + key.toLowerCase() + keySuffix;
这篇关于所有字母表的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!