How to search / replace capital letter in middle of word

How to search / replace capital letter in middle of word

8
NewbieNewbie
8

    Feb 09, 2011#1

    Hi

    How I can search and replace capital letter which is:

    1. not on beginning of the sentence and in middle or end of some word - They are walKing. - here I need to find capital K and replace it with k

    2. not on beginning of sentence but on beginning of one word in sentence - They are Walking. - here I need to find capital W and replace it with w

    I tried find with ^[^K].*[K] but it is not good one.

    Thanks

    236
    MasterMaster
    236

      Feb 09, 2011#2

      Activate Perl regular expression and make sure that the case sensitivity option is turned on. Then search for

      Code: Select all

      (?<!^)(?<![.!:?] )([A-Z])
      and replace with

      Code: Select all

      \L\1
      The first regex checks that the current character is neither at the start of a line nor directly following a punctuation character and a space. Then it tries to match an uppercase letter. The replace operation converts that into lowercase.

      It's not a very reliable solution, but then how reliably can you tell whether you're at the start or in the middle of a sentence?

      8
      NewbieNewbie
      8

        Feb 11, 2011#3

        Thank You very much it works correctly