1

I cant seem find any answers on this but how does one find and replace in notepad++.

For example: I am trying to find all lines that contain 4 pipes between the amount and name. How can I find this to add an additional pipe, making it 5 pipes between?

$13.00||||Andover Lakes||||1512
$45.00|||||Hillside Bay||||1513
$45.00||||Crystal Manor||||1514
$89.00|||||Cypress Resort||||1515

I tried \|\|\|\|[a-z] but then it changes the first initial to [a-z]. What is the pattern I need in order to find something without having to literally change what I don't want to change?

2
  • Ctrl+H
  • Find what: (?<=\d)\|{4}(?=[a-zA-Z])
  • Replace with: |$0
  • CHECK Wrap around
  • CHECK Regular expression
  • Replace all

Explanation:

(?<=\d)         # positive lookbehind, zero length assertion that makes sure we have a digit before
\|{4}           # 4 pipes
(?=[a-zA-Z])    # positive lookahead, zero length assertion that makes sure we have a letter after

Replacement:

|           # a pipe
$0          # the whole match (i.e. 4 pipes)

Screen capture (before):

enter image description here

Screen capture (after):

enter image description here

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.