tags:

views:

424

answers:

2

Hello!

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.

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.

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!

Thank you!

+4  A: 

TextPad will allow you to perform this opperation.

example:

test this sentence

Find what: \([^ ]*\) \(.*\) Replace with: \U\1\E \2

the \U will cause all following chars to be upper

the \E will turn off the \U

the result will be:

TEST this sentence
akf
A: 

EditPad Pro and PowerGREP have a unique feature that allows you to change the case of the backreference. \U1 inserts the first backreference in uppercase, \L1 in lowercase and \F1 with the first character in uppercase and the remainder in lowercase. Finally, \I1 inserts it with the first letter of each word capitalized, and the other letters in lowercase.

Source: Goyvaerts, Jan (2006). Regular Expressions: The Complete Tutorial. Lulu.com. p. 35. ISBN 1411677609. Google Books. Retrieved on June 25, 2010.

quantomcat