Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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:".

share|improve this answer
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .