0

Helly everyone,

I am struggling to find out how to exclude a word in a line of text in notepad++

I am using the "find in files" option to search through many large log files.

My search string is as follows:

"Searching for user with username '.*' and domain name"

(This will show all usernames where '.*' is the username part. So the result is all names are shown which is great.

However there is a certain username that I want ignored in the output for example UsernameX1 I do not want to be shown in the output

so output" I want lines like these to be ignored with word "usernameX1" and only show other usernames whilst ignoring usernamex1

So in the output I want this line below to be ignored

"Searching for user with username 'usernameX1' and domain name "

and only lines like these to show:

"Searching for user with username 'usernameA1' and domain name "
"Searching for user with username 'Chrisv' and domain name "
"Searching for user with username 'brianz' and domain name "

etc.

Is there a tool, method or plugin I can use that helps me sort this out?

2
  • 1
    Please, edit your question and add sample text and expected result. Do you want to match username or not? It's not clear.
    – Toto
    Dec 31, 2020 at 12:15
  • Thank you for your message. I have amended my question. I hope this clarifies it better. Thanks for your help
    – ichiban
    Dec 31, 2020 at 13:48

1 Answer 1

0
  • Ctrl+F
  • Select "Mark" tab
  • Find what: Searching for user with username '(?!usernameX1).+?' and domain name
  • CHECK Bookmark line
  • CHECK Wrap around
  • CHECK Regular expression
  • Mark all

Explanation:

(?!             # negative lookahead, make sure we haven't after:
usernameX1      # usernameX1
)               # end lookahead
.+?             # 1 or more any character, not greedy

Screenshot:

enter image description here

1

You must log in to answer this question.

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