使用正则表达式将字符转换为大写 (EditPad Pro) [英] Convert a char to upper case using regular expressions (EditPad Pro)

查看:39
本文介绍了使用正则表达式将字符转换为大写 (EditPad Pro)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个正则表达式,希望我能够将每个匹配项(只有一个字符)替换为大写字符.我正在使用 EditPad Pro(不过,我愿意使用任何其他允许我执行此操作的工具,只要它可以免费尝试,因为我只需要执行一次).

I wrote a regular expression in hope that I will be able to replace every match (that is just one char) to upper case char. I am using EditPad Pro (however I am willing to use any other tool that would allow me to do this, as long as it is free to try, since I only need to do this once).

背景:我有一个很长的文本文件,被一个区分大小写的应用程序使用,有些单词以小写字母而不是大写字母开头,从而导致应用程序崩溃.手工完成这将需要很长时间,如果没有正则表达式会非常复杂,因为(邪恶的)小写字符的出现非常具体.

Background: I have a very long text file used by a case sensitive application, and some words start with lower case instead of upper case char, thus crashing the application. This would take very long to do by hand, and it would be quite complicated to do without regular expressions because the occurrence of the (evil) lower case char is very specific.

我已经编写了 select 正则表达式,现在我可以将它与反向引用一起使用($1 工作得很好),但是我无法将其替换为大写字符.我认为像 \u$1 这样的东西会起作用,但它在 EditPad Pro 中不起作用.

I have written the select regular expression and now I can use it with a backreference ($1 works just fine) however I can't make it replace with upper case char. I thought something like \u$1 would work, however it doesn't in EditPad Pro.

如果没有免费工具允许我这样做,我想另一种选择是在 C# 中进行,但是我有点赶时间,而且还没有接近编译器,所以我必须下载 express 版本首先,所以......最好找到一个支持这种功能的工具!

If no free tool allows me to do this, I guess the alternative would be to just do it in C# however I am in a bit of a hurry and not near a compiler, so I'd have to download the express edition first, so ... It would be preferable to find a tool that supports such a feature!

谢谢!

推荐答案

TextPad 将允许您执行此操作.

TextPad will allow you to perform this operation.

示例:

test this sentence

求什么:\([^ ]*\) \(.*\)替换为:\U\1\E\2

\U 将导致后面的所有字符都在上面

the \U will cause all following chars to be upper

\E 将关闭 \U

结果将是:

TEST this sentence

这篇关于使用正则表达式将字符转换为大写 (EditPad Pro)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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