I would like to replace a tagged area with UPPERCASE converted characters (regular expression search and replace).
Some help would be appreciated as I've been trying to figure that out for quite some time now.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps using a macro will be the way to go here. You have to pre-set the Find dialog and then use F3 and CTRL+SHIFT+U in the macro and run it until the end of the file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That sounded like a good idea but for some reason the uppercase conversion deletes the selected text when run from a macro.
It works fine when I just repeatedly press [F3 -> Ctrl+Shift+U] but that's hardly practical as I'm working with some huge text files here.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the end a friend wrote a javascript for me to do the replacements.
Still it would be nice if NP++ would support these operators:
\u = next letter upperase
\U = following letters uppercase
\l = next letter lowercase
\L = following letters lowercase
\E = stop case conversion at this point
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'll answer this with what he said: "Thanks for the fun problem."
Yeah, I guess it's good to have friends like that. Here's the script:
// Save this as "replace.js".
// File to be converted is called "file.txt".
// Delimiters of the text to be converted are "<pattern>" and "</pattern>" here.
// To start the script enter on a command prompt:
// cscript //E:jscript //NoLogo replace.js > new.txt
// "new.text" contains the converted data
var fso = new ActiveXObject('Scripting.FileSystemObject');
var fs = fso.OpenTextFile('file.txt');
var s = new String(fs.ReadAll());
fs.Close();
s = s.replace(/<pattern>(.*?)<\/pattern>/gi, function($1){ return $1.replace(/>.*</, function($1){ return $1.toUpperCase();})});
WScript.Echo(s);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I would like to replace a tagged area with UPPERCASE converted characters (regular expression search and replace).
It would be a great thing if regex did that (among others). Too bad it doesn't come that way. I wonder how hard it would be to modify regex ....... hmmmmmmmm
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like to replace a tagged area with UPPERCASE converted characters (regular expression search and replace).
Some help would be appreciated as I've been trying to figure that out for quite some time now.
Thanks!
The TextFX Character plugin can convert selected text to uppercase, lowercase, etc.
Perhaps using a macro will be the way to go here. You have to pre-set the Find dialog and then use F3 and CTRL+SHIFT+U in the macro and run it until the end of the file.
That sounded like a good idea but for some reason the uppercase conversion deletes the selected text when run from a macro.
It works fine when I just repeatedly press [F3 -> Ctrl+Shift+U] but that's hardly practical as I'm working with some huge text files here.
Perhaps you could create an AutoHotKey script/macro as an alternative then.
In the end a friend wrote a javascript for me to do the replacements.
Still it would be nice if NP++ would support these operators:
\u = next letter upperase
\U = following letters uppercase
\l = next letter lowercase
\L = following letters lowercase
\E = stop case conversion at this point
It's always good to have a friend do your work.
I'll answer this with what he said: "Thanks for the fun problem."
Yeah, I guess it's good to have friends like that. Here's the script:
// Save this as "replace.js".
// File to be converted is called "file.txt".
// Delimiters of the text to be converted are "<pattern>" and "</pattern>" here.
// To start the script enter on a command prompt:
// cscript //E:jscript //NoLogo replace.js > new.txt
// "new.text" contains the converted data
var fso = new ActiveXObject('Scripting.FileSystemObject');
var fs = fso.OpenTextFile('file.txt');
var s = new String(fs.ReadAll());
fs.Close();
s = s.replace(/<pattern>(.*?)<\/pattern>/gi, function($1){ return $1.replace(/>.*</, function($1){ return $1.toUpperCase();})});
WScript.Echo(s);
> I would like to replace a tagged area with UPPERCASE converted characters (regular expression search and replace).
It would be a great thing if regex did that (among others). Too bad it doesn't come that way. I wonder how hard it would be to modify regex ....... hmmmmmmmm