2

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.

eLRuLL
  • 18,488
  • 9
  • 73
  • 99
Sae Us
  • 277
  • 1
  • 6
  • 21

1 Answers1

1

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.

Update

Looks like it is a plugin:

TextFX menu is missing in Notepad++

Multiple Files

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).

Community
  • 1
  • 1
bozdoz
  • 12,550
  • 7
  • 67
  • 96
  • Ok that looks good - however i have multiple files and each line has multiple pieces of info so I dont want to select. – Sae Us May 09 '13 at 16:49
  • Added a Find in Files solution for you @SaeUs – bozdoz May 09 '13 at 16:56
  • Fantastic that works! However I need to read on regex to understand what the \d and \w mean. Thanks again – Sae Us May 09 '13 at 17:14
  • Oh, sorry about that. \d is digit, {2} finds exactly two digits, which would find the day and years in your example, and \w is word character which would match the months between the hyphens exactly {3} of them. – bozdoz May 09 '13 at 17:40