I'm constantly working with recognition of text and I end up having capital/uppercase letters in the middle or at the end of the words (e.g. wOrd instead of word; leSS instead of less).

  1. Is there a way to do a find&replace, using notepad++ so that the capital/lowercase chars are transformed into small/lowercase chars? (I can select the entire text, and change all chars to small/lowercase, but this will change names, beginning of sentences with incorrect chars)
  2. is it possible to avoid transforming words which are abbreviations from being changed (e.g. USA should remain unchanged)?
  3. (something more difficult) is it possible to exclude some words from this transformation? For example, there are some physical units (e.g. eV, mW, kJ) which should remain the same, i.e. they should not be changed. ... I think, in general, the physical units are 2 chars words (there are some exceptions here too, but I think I can handle them manually)

Thank you! R

  • Could you gives more test cases, what is the expected result for: WORD, WoRd, Word, IS, tHE, iT ... – Toto Apr 26 at 13:09
  • The expected results (in the same order): WORD (my second request/question), Word, Word, IS, the, it (I know this somehow breaks my 3rd request/question, but ... this (physical) units are not very frequent). Thank you! – radu i Apr 26 at 14:21

Yes, you can do it in Notepad++:

  • Find what: ([a-z]+[A-Z]+\w*)
  • replace to: \L\1
  • make sure "match case" and "regular expression" are checked

This will look for character sequences starting with lowercase letter(s) and containing uppercase letter(s) and convert them to lowercase

  • will not convert abbreviations (USA) as those don't contain lowercase letter
  • will not convert uppercase letter(s) at the beginning of word
    (e.g. "UPpERCase" => "UPpercase" as regex will match and convert "pERCase")
  • you can check how it works here

As per setting up exceptions is more difficult and I don't have a suggestion for that.

  • Ctrl+H
  • Find what: \b(?!(?:[A-Z]+|eV|mW|kJ)\b)([A-Z]?)(\w+)
  • Replace with: $1\L$2
  • check Match case
  • check Wrap around
  • check Regular expression
  • Replace all


\b              # word boundary
(?!             # negative lookahead, make sure we haven't a word 
  (?:           # non capture group
    [A-Z]+      # all word is uppercase
  |             # OR
    eV          # literally (electronVolt)
  |             # OR
    mW          # literally (milliWatt)
  |             # OR
    kJ          # literally (kiloJoule)  (You can add all exeptions you want here)
([A-Z]?)        # group 1, an optional uppercase at the beginning of a word
(\w+)           # group 2, 1 or more word character


$1          # content of group 1, optional uppercase
\L$2        # lowercased group 2


WORD, WoRd, Word, IS, tHE, iT, eV, mW, kJ

Result for given example:

WORD, Word, Word, IS, the, it, eV, mW, kJ

Screen capture:

enter image description here

If you want to deal with all units and (sub-)multiples, change the Find what into:



[yzafpnµmcdhk]      # y(octo), z(epto), a(tto), f(emto), p(ico), n(ano), µ(micro), m(illi), c(enti), d(eci), h(ecto), k(ilo)
da                  # deca

[ACFJKLNSTVW]       # A(mpère), C(oulomb), F(arad), J(oule), K(elvin), L(iter), N(ewton), S(iemens), T(esla), V(olt), W(att)
Bq                  # Becquerel
Gy                  # Gray
Hz                  # Hertz
Pa                  # Pascal
Sv                  # Sievert
Wb                  # Weber
eV                  # Electronvolt

If you use \L you will lowercase ALL you have on its right; if you just need to lowercase the match (eg: $1) then use \l (lowercase L).

EG: First Letter Is Uppercase
rexp (\w+) (\w+) (\w+) (\w+)

repl-> \L$1 $2 $3 $4
result-> first letter is uppercase

repl-> \l$1 $2 $3 $4
result-> first Letter Is Uppercase

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.