Reputation: 277
Doing some String manipulation and I want to ask if the below is possible in Notepad++:
I have a string with Years:
10-Jan-13
22-Feb-14
10-Jan-13
10-Mar-13
I want
10-JAN-13
22-FEB-14
10-JAN-13
10-MAR-13
(There's more data on each line there but I am just showing a simplified example).
I know I can OR search with | character so find, JAN|FEB|MAR... but how do I replace according to what's found.
(Just trying to save some time)
Thanks.
Upvotes: 2
Views: 2251
Reputation: 12860
Not sure if it's a plugin or built-in, but you can use the TextFX Characters plugin, to select the text, and then in the textfx characters dropdown, click UPPER CASE.
Looks like it is a plugin:
TextFX menu is missing in Notepad++
I found this site which gives a way to convert text to uppercase with regular expressions: http://vim.wikia.com/wiki/Changing_case_with_regular_expressions
So, what you can do is bring up the find in files dialog (CTRL+SHIFT+F), change search mode to Regular Expression, and then use something like this:
Find: (\d{2}-\w{3}-\d{2})
Replace with: \U\1
Directory: Whichever directory your files are in (and only the files you want changed).
\U
is an uppercase flag, and the brackets in the Find regex correspond with the \1
backreference, which will basically replace it with itself (but uppercase).
Upvotes: 1