正则表达式将字符串字符英语化? [英] Regular Expression To Anglicize String Characters?

查看:40
本文介绍了正则表达式将字符串字符英语化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个通用的正则表达式可以替换非英语语言中所有已知的特殊字符:

Is there a common regular expression that replaces all known special characters in non-English languages:

é, ô, ç, etc.

带英文字符:

e, o, c, etc.

推荐答案

不,没有这样的正则表达式.请注意,使用正则表达式可以描述"一段特定的文本.

No, there is no such regex. Note that with a regex you "describe" a specific piece of text.

某个正则表达式实现可能提供使用正则表达式进行替换的可能性,但这些替换通常仅由单个替换执行:不将 a 替换为 a'bb'

A certain regex implementation might provide the possibility to do replacements using regex, but these replacements are usually only performed by a single replacement: not replace a with a' and b with b' etc.

也许您使用的语言在其 API 中有一个方法来执行这种替换,但它不会使用正则表达式.

Perhaps the language you're working with has a method in its API to perform this kind of replacements, but it won't be using regex.

这篇关于正则表达式将字符串字符英语化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆