I need to replace something like this:

userPassword: {SSHA}hLPcGtsS+sUhwlYq/23dsECuRGsvJj59OQXXJQ==

with something like this:


I have tried some random stuff I've found, but no luck. What would the code be with regexp?


To match the last 40 characters of a line you would use the regex:


This means: "Match any character 40 times followed by end of line".

If you're interested in replacing the entire line you would use the regex


and a Replacement text of

first part:\1 second part:\2

would change your example text to

first part:userPassword:  second part:{SSHA}hLPcGtsS+sUhwlYq/23dsECuRGsvJj59OQXXJQ==

The brackets create a capture group and notepad++ replaces \n with the nth capture group.

Alternatevly, for your particular example (depends on what the other lines look like) you could use a pattern of


Which simply matches all lines starting with "userPassword:".

  • 1
    Can you add some explanation of why this answers the question. – ChrisF Apr 24 '13 at 22:03
  • You sir rock, thank you! I ended up just using the ^(userPassword:).*$ the other method confused me a bit. – Anthony Apr 25 '13 at 14:51

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.