Search code examples
regexnotepad++

How to remove everything after a certain character? (notepad++)


I need to remove everything after a certain character. For example in the following line:

email:pass | text | text | text | text

How would I remove everything past the "pass" so it ends up like this :

email:pass

Thank you in advance!


Solution

  • Do a find replace (replacing with nothing) this regex:

    \|.*
    

    See https://regexr.com/3rq9m for explanation.