0

I have a text file.

tart*)*98'bank'ksb64bank)(tart2d&f44bank

I want to replace to: I want search tart*.*bank and change "bank" to "replaced"

tart*)*98'replaced'ksb64bank)(tart2d&f44replaced

Thanks.

3
  • 5
    Are you purposely not replacing the second bank? Commented Jan 31, 2013 at 23:48
  • the 2nd bank is also in tart*.*bank case, buddy, it should be replaced as well. In fact if your string starts with tart*, all banks should be replaced. Commented Jan 31, 2013 at 23:52
  • 2
    At least try something first.. Commented Feb 1, 2013 at 0:09

1 Answer 1

1

Find what: (tart.*?)(bank)

Replace with: \1replaced

  • () are for grouping so you can reference groups in replace with field like \1 for first group
  • .* is greedy and it would match the rest of the string so ? is for making .* non-greedy and matching only until first bank is not matched
Sign up to request clarification or add additional context in comments.

2 Comments

Hi thanks but output is $1replaced'ksb64bank)($1replaced I want to: tart*)*98'replaced'ksb64bank)(tart2d&f44replaced
For me it is exactly as you want, my notepad++ is version 6.1.2 you can try with \1replaced

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.